57a2d566227433bc3b3461a7e37ad0b44ae0fe12
[platform/framework/web/crosswalk.git] / src / chrome / tools / test / reference_build / chrome_linux / resources / inspector / inspector.js
1 Object.isEmpty=function(obj)
2 {for(var i in obj)
3 return false;return true;}
4 Object.values=function(obj)
5 {var result=Object.keys(obj);var length=result.length;for(var i=0;i<length;++i)
6 result[i]=obj[result[i]];return result;}
7 String.prototype.findAll=function(string)
8 {var matches=[];var i=this.indexOf(string);while(i!==-1){matches.push(i);i=this.indexOf(string,i+string.length);}
9 return matches;}
10 String.prototype.lineEndings=function()
11 {if(!this._lineEndings){this._lineEndings=this.findAll("\n");this._lineEndings.push(this.length);}
12 return this._lineEndings;}
13 String.prototype.escapeCharacters=function(chars)
14 {var foundChar=false;for(var i=0;i<chars.length;++i){if(this.indexOf(chars.charAt(i))!==-1){foundChar=true;break;}}
15 if(!foundChar)
16 return String(this);var result="";for(var i=0;i<this.length;++i){if(chars.indexOf(this.charAt(i))!==-1)
17 result+="\\";result+=this.charAt(i);}
18 return result;}
19 String.regexSpecialCharacters=function()
20 {return"^[]{}()\\.$*+?|-,";}
21 String.prototype.escapeForRegExp=function()
22 {return this.escapeCharacters(String.regexSpecialCharacters());}
23 String.prototype.escapeHTML=function()
24 {return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");}
25 String.prototype.collapseWhitespace=function()
26 {return this.replace(/[\s\xA0]+/g," ");}
27 String.prototype.trimMiddle=function(maxLength)
28 {if(this.length<=maxLength)
29 return String(this);var leftHalf=maxLength>>1;var rightHalf=maxLength-leftHalf-1;return this.substr(0,leftHalf)+"\u2026"+this.substr(this.length-rightHalf,rightHalf);}
30 String.prototype.trimEnd=function(maxLength)
31 {if(this.length<=maxLength)
32 return String(this);return this.substr(0,maxLength-1)+"\u2026";}
33 String.prototype.trimURL=function(baseURLDomain)
34 {var result=this.replace(/^(https|http|file):\/\//i,"");if(baseURLDomain)
35 result=result.replace(new RegExp("^"+baseURLDomain.escapeForRegExp(),"i"),"");return result;}
36 String.prototype.toTitleCase=function()
37 {return this.substring(0,1).toUpperCase()+this.substring(1);}
38 String.prototype.compareTo=function(other)
39 {if(this>other)
40 return 1;if(this<other)
41 return-1;return 0;}
42 function sanitizeHref(href)
43 {return href&&href.trim().toLowerCase().startsWith("javascript:")?null:href;}
44 String.prototype.removeURLFragment=function()
45 {var fragmentIndex=this.indexOf("#");if(fragmentIndex==-1)
46 fragmentIndex=this.length;return this.substring(0,fragmentIndex);}
47 String.prototype.startsWith=function(substring)
48 {return!this.lastIndexOf(substring,0);}
49 String.prototype.endsWith=function(substring)
50 {return this.indexOf(substring,this.length-substring.length)!==-1;}
51 String.prototype.hashCode=function()
52 {var result=0;for(var i=0;i<this.length;++i)
53 result=result*3+this.charCodeAt(i);return result;}
54 String.naturalOrderComparator=function(a,b)
55 {var chunk=/^\d+|^\D+/;var chunka,chunkb,anum,bnum;while(1){if(a){if(!b)
56 return 1;}else{if(b)
57 return-1;else
58 return 0;}
59 chunka=a.match(chunk)[0];chunkb=b.match(chunk)[0];anum=!isNaN(chunka);bnum=!isNaN(chunkb);if(anum&&!bnum)
60 return-1;if(bnum&&!anum)
61 return 1;if(anum&&bnum){var diff=chunka-chunkb;if(diff)
62 return diff;if(chunka.length!==chunkb.length){if(!+chunka&&!+chunkb)
63 return chunka.length-chunkb.length;else
64 return chunkb.length-chunka.length;}}else if(chunka!==chunkb)
65 return(chunka<chunkb)?-1:1;a=a.substring(chunka.length);b=b.substring(chunkb.length);}}
66 Number.constrain=function(num,min,max)
67 {if(num<min)
68 num=min;else if(num>max)
69 num=max;return num;}
70 Number.gcd=function(a,b)
71 {if(b===0)
72 return a;else
73 return Number.gcd(b,a%b);}
74 Number.toFixedIfFloating=function(value)
75 {if(!value||isNaN(value))
76 return value;var number=Number(value);return number%1?number.toFixed(3):String(number);}
77 Date.prototype.toISO8601Compact=function()
78 {function leadZero(x)
79 {return(x>9?"":"0")+x;}
80 return this.getFullYear()+
81 leadZero(this.getMonth()+1)+
82 leadZero(this.getDate())+"T"+
83 leadZero(this.getHours())+
84 leadZero(this.getMinutes())+
85 leadZero(this.getSeconds());}
86 Object.defineProperty(Array.prototype,"remove",{value:function(value,onlyFirst)
87 {if(onlyFirst){var index=this.indexOf(value);if(index!==-1)
88 this.splice(index,1);return;}
89 var length=this.length;for(var i=0;i<length;++i){if(this[i]===value)
90 this.splice(i,1);}}});Object.defineProperty(Array.prototype,"keySet",{value:function()
91 {var keys={};for(var i=0;i<this.length;++i)
92 keys[this[i]]=true;return keys;}});Object.defineProperty(Array.prototype,"rotate",{value:function(index)
93 {var result=[];for(var i=index;i<index+this.length;++i)
94 result.push(this[i%this.length]);return result;}});Object.defineProperty(Uint32Array.prototype,"sort",{value:Array.prototype.sort});(function(){var partition={value:function(comparator,left,right,pivotIndex)
95 {function swap(array,i1,i2)
96 {var temp=array[i1];array[i1]=array[i2];array[i2]=temp;}
97 var pivotValue=this[pivotIndex];swap(this,right,pivotIndex);var storeIndex=left;for(var i=left;i<right;++i){if(comparator(this[i],pivotValue)<0){swap(this,storeIndex,i);++storeIndex;}}
98 swap(this,right,storeIndex);return storeIndex;}};Object.defineProperty(Array.prototype,"partition",partition);Object.defineProperty(Uint32Array.prototype,"partition",partition);var sortRange={value:function(comparator,leftBound,rightBound,sortWindowLeft,sortWindowRight)
99 {function quickSortRange(array,comparator,left,right,sortWindowLeft,sortWindowRight)
100 {if(right<=left)
101 return;var pivotIndex=Math.floor(Math.random()*(right-left))+left;var pivotNewIndex=array.partition(comparator,left,right,pivotIndex);if(sortWindowLeft<pivotNewIndex)
102 quickSortRange(array,comparator,left,pivotNewIndex-1,sortWindowLeft,sortWindowRight);if(pivotNewIndex<sortWindowRight)
103 quickSortRange(array,comparator,pivotNewIndex+1,right,sortWindowLeft,sortWindowRight);}
104 if(leftBound===0&&rightBound===(this.length-1)&&sortWindowLeft===0&&sortWindowRight>=rightBound)
105 this.sort(comparator);else
106 quickSortRange(this,comparator,leftBound,rightBound,sortWindowLeft,sortWindowRight);return this;}}
107 Object.defineProperty(Array.prototype,"sortRange",sortRange);Object.defineProperty(Uint32Array.prototype,"sortRange",sortRange);})();Object.defineProperty(Array.prototype,"stableSort",{value:function(comparator)
108 {function defaultComparator(a,b)
109 {return a<b?-1:(a>b?1:0);}
110 comparator=comparator||defaultComparator;var indices=new Array(this.length);for(var i=0;i<this.length;++i)
111 indices[i]=i;var self=this;function indexComparator(a,b)
112 {var result=comparator(self[a],self[b]);return result?result:a-b;}
113 indices.sort(indexComparator);for(var i=0;i<this.length;++i){if(indices[i]<0||i===indices[i])
114 continue;var cyclical=i;var saved=this[i];while(true){var next=indices[cyclical];indices[cyclical]=-1;if(next===i){this[cyclical]=saved;break;}else{this[cyclical]=this[next];cyclical=next;}}}
115 return this;}});Object.defineProperty(Array.prototype,"qselect",{value:function(k,comparator)
116 {if(k<0||k>=this.length)
117 return;if(!comparator)
118 comparator=function(a,b){return a-b;}
119 var low=0;var high=this.length-1;for(;;){var pivotPosition=this.partition(comparator,low,high,Math.floor((high+low)/2));if(pivotPosition===k)
120 return this[k];else if(pivotPosition>k)
121 high=pivotPosition-1;else
122 low=pivotPosition+1;}}});Object.defineProperty(Array.prototype,"lowerBound",{value:function(object,comparator)
123 {function defaultComparator(a,b)
124 {return a<b?-1:(a>b?1:0);}
125 comparator=comparator||defaultComparator;var l=0;var r=this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>0)
126 l=m+1;else
127 r=m;}
128 return r;}});Object.defineProperty(Array.prototype,"upperBound",{value:function(object,comparator)
129 {function defaultComparator(a,b)
130 {return a<b?-1:(a>b?1:0);}
131 comparator=comparator||defaultComparator;var l=0;var r=this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>=0)
132 l=m+1;else
133 r=m;}
134 return r;}});Object.defineProperty(Array.prototype,"binaryIndexOf",{value:function(value,comparator)
135 {var index=this.lowerBound(value,comparator);return index<this.length&&comparator(value,this[index])===0?index:-1;}});Object.defineProperty(Array.prototype,"select",{value:function(field)
136 {var result=new Array(this.length);for(var i=0;i<this.length;++i)
137 result[i]=this[i][field];return result;}});Object.defineProperty(Array.prototype,"peekLast",{value:function()
138 {return this[this.length-1];}});(function(){function mergeOrIntersect(array1,array2,comparator,mergeNotIntersect)
139 {var result=[];var i=0;var j=0;while(i<array1.length||j<array2.length){if(i===array1.length){result=result.concat(array2.slice(j));j=array2.length;}else if(j===array2.length){result=result.concat(array1.slice(i));i=array1.length;}else{var compareValue=comparator(array1[i],array2[j])
140 if(compareValue<0){if(mergeNotIntersect)
141 result.push(array1[i]);++i;}else if(compareValue>0){if(mergeNotIntersect)
142 result.push(array2[j]);++j;}else{result.push(array1[i]);++i;++j;}}}
143 return result;}
144 Object.defineProperty(Array.prototype,"intersectOrdered",{value:function(array,comparator)
145 {return mergeOrIntersect(this,array,comparator,false);}});Object.defineProperty(Array.prototype,"mergeOrdered",{value:function(array,comparator)
146 {return mergeOrIntersect(this,array,comparator,true);}});}());function insertionIndexForObjectInListSortedByFunction(object,list,comparator,insertionIndexAfter)
147 {if(insertionIndexAfter)
148 return list.upperBound(object,comparator);else
149 return list.lowerBound(object,comparator);}
150 String.sprintf=function(format,var_arg)
151 {return String.vsprintf(format,Array.prototype.slice.call(arguments,1));}
152 String.tokenizeFormatString=function(format,formatters)
153 {var tokens=[];var substitutionIndex=0;function addStringToken(str)
154 {tokens.push({type:"string",value:str});}
155 function addSpecifierToken(specifier,precision,substitutionIndex)
156 {tokens.push({type:"specifier",specifier:specifier,precision:precision,substitutionIndex:substitutionIndex});}
157 function isDigit(c)
158 {return!!/[0-9]/.exec(c);}
159 var index=0;for(var precentIndex=format.indexOf("%",index);precentIndex!==-1;precentIndex=format.indexOf("%",index)){addStringToken(format.substring(index,precentIndex));index=precentIndex+1;if(isDigit(format[index])){var number=parseInt(format.substring(index),10);while(isDigit(format[index]))
160 ++index;if(number>0&&format[index]==="$"){substitutionIndex=(number-1);++index;}}
161 var precision=-1;if(format[index]==="."){++index;precision=parseInt(format.substring(index),10);if(isNaN(precision))
162 precision=0;while(isDigit(format[index]))
163 ++index;}
164 if(!(format[index]in formatters)){addStringToken(format.substring(precentIndex,index+1));++index;continue;}
165 addSpecifierToken(format[index],precision,substitutionIndex);++substitutionIndex;++index;}
166 addStringToken(format.substring(index));return tokens;}
167 String.standardFormatters={d:function(substitution)
168 {return!isNaN(substitution)?substitution:0;},f:function(substitution,token)
169 {if(substitution&&token.precision>-1)
170 substitution=substitution.toFixed(token.precision);return!isNaN(substitution)?substitution:(token.precision>-1?Number(0).toFixed(token.precision):0);},s:function(substitution)
171 {return substitution;}}
172 String.vsprintf=function(format,substitutions)
173 {return String.format(format,substitutions,String.standardFormatters,"",function(a,b){return a+b;}).formattedResult;}
174 String.format=function(format,substitutions,formatters,initialValue,append)
175 {if(!format||!substitutions||!substitutions.length)
176 return{formattedResult:append(initialValue,format),unusedSubstitutions:substitutions};function prettyFunctionName()
177 {return"String.format(\""+format+"\", \""+substitutions.join("\", \"")+"\")";}
178 function warn(msg)
179 {console.warn(prettyFunctionName()+": "+msg);}
180 function error(msg)
181 {console.error(prettyFunctionName()+": "+msg);}
182 var result=initialValue;var tokens=String.tokenizeFormatString(format,formatters);var usedSubstitutionIndexes={};for(var i=0;i<tokens.length;++i){var token=tokens[i];if(token.type==="string"){result=append(result,token.value);continue;}
183 if(token.type!=="specifier"){error("Unknown token type \""+token.type+"\" found.");continue;}
184 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;}
185 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;}
186 result=append(result,formatters[token.specifier](substitutions[token.substitutionIndex],token));}
187 var unusedSubstitutions=[];for(var i=0;i<substitutions.length;++i){if(i in usedSubstitutionIndexes)
188 continue;unusedSubstitutions.push(substitutions[i]);}
189 return{formattedResult:result,unusedSubstitutions:unusedSubstitutions};}
190 function createSearchRegex(query,caseSensitive,isRegex)
191 {var regexFlags=caseSensitive?"g":"gi";var regexObject;if(isRegex){try{regexObject=new RegExp(query,regexFlags);}catch(e){}}
192 if(!regexObject)
193 regexObject=createPlainTextSearchRegex(query,regexFlags);return regexObject;}
194 function createPlainTextSearchRegex(query,flags)
195 {var regexSpecialCharacters=String.regexSpecialCharacters();var regex="";for(var i=0;i<query.length;++i){var c=query.charAt(i);if(regexSpecialCharacters.indexOf(c)!=-1)
196 regex+="\\";regex+=c;}
197 return new RegExp(regex,flags||"");}
198 function countRegexMatches(regex,content)
199 {var text=content;var result=0;var match;while(text&&(match=regex.exec(text))){if(match[0].length>0)
200 ++result;text=text.substring(match.index+1);}
201 return result;}
202 function numberToStringWithSpacesPadding(value,symbolsCount)
203 {var numberString=value.toString();var paddingLength=Math.max(0,symbolsCount-numberString.length);var paddingString=Array(paddingLength+1).join("\u00a0");return paddingString+numberString;}
204 var createObjectIdentifier=function()
205 {return"_"+ ++createObjectIdentifier._last;}
206 createObjectIdentifier._last=0;var Set=function()
207 {this._set={};this._size=0;}
208 Set.prototype={add:function(item)
209 {var objectIdentifier=item.__identifier;if(!objectIdentifier){objectIdentifier=createObjectIdentifier();item.__identifier=objectIdentifier;}
210 if(!this._set[objectIdentifier])
211 ++this._size;this._set[objectIdentifier]=item;},remove:function(item)
212 {if(this._set[item.__identifier]){--this._size;delete this._set[item.__identifier];return true;}
213 return false;},items:function()
214 {var result=new Array(this._size);var i=0;for(var objectIdentifier in this._set)
215 result[i++]=this._set[objectIdentifier];return result;},hasItem:function(item)
216 {return!!this._set[item.__identifier];},size:function()
217 {return this._size;},clear:function()
218 {this._set={};this._size=0;}}
219 var Map=function()
220 {this._map={};this._size=0;}
221 Map.prototype={put:function(key,value)
222 {var objectIdentifier=key.__identifier;if(!objectIdentifier){objectIdentifier=createObjectIdentifier();key.__identifier=objectIdentifier;}
223 if(!this._map[objectIdentifier])
224 ++this._size;this._map[objectIdentifier]=[key,value];},remove:function(key)
225 {var result=this._map[key.__identifier];if(!result)
226 return undefined;--this._size;delete this._map[key.__identifier];return result[1];},keys:function()
227 {return this._list(0);},values:function()
228 {return this._list(1);},_list:function(index)
229 {var result=new Array(this._size);var i=0;for(var objectIdentifier in this._map)
230 result[i++]=this._map[objectIdentifier][index];return result;},get:function(key)
231 {var entry=this._map[key.__identifier];return entry?entry[1]:undefined;},contains:function(key)
232 {var entry=this._map[key.__identifier];return!!entry;},size:function()
233 {return this._size;},clear:function()
234 {this._map={};this._size=0;}}
235 var StringMap=function()
236 {this._map={};this._size=0;}
237 StringMap.prototype={put:function(key,value)
238 {if(key==="__proto__"){if(!this._hasProtoKey){++this._size;this._hasProtoKey=true;}
239 this._protoValue=value;return;}
240 if(!Object.prototype.hasOwnProperty.call(this._map,key))
241 ++this._size;this._map[key]=value;},remove:function(key)
242 {var result;if(key==="__proto__"){if(!this._hasProtoKey)
243 return undefined;--this._size;delete this._hasProtoKey;result=this._protoValue;delete this._protoValue;return result;}
244 if(!Object.prototype.hasOwnProperty.call(this._map,key))
245 return undefined;--this._size;result=this._map[key];delete this._map[key];return result;},keys:function()
246 {var result=Object.keys(this._map)||[];if(this._hasProtoKey)
247 result.push("__proto__");return result;},values:function()
248 {var result=Object.values(this._map);if(this._hasProtoKey)
249 result.push(this._protoValue);return result;},get:function(key)
250 {if(key==="__proto__")
251 return this._protoValue;if(!Object.prototype.hasOwnProperty.call(this._map,key))
252 return undefined;return this._map[key];},contains:function(key)
253 {var result;if(key==="__proto__")
254 return this._hasProtoKey;return Object.prototype.hasOwnProperty.call(this._map,key);},size:function()
255 {return this._size;},clear:function()
256 {this._map={};this._size=0;delete this._hasProtoKey;delete this._protoValue;}}
257 function loadXHR(url,async,callback)
258 {function onReadyStateChanged()
259 {if(xhr.readyState!==XMLHttpRequest.DONE)
260 return;if(xhr.status===200){callback(xhr.responseText);return;}
261 callback(null);}
262 var xhr=new XMLHttpRequest();xhr.open("GET",url,async);if(async)
263 xhr.onreadystatechange=onReadyStateChanged;xhr.send(null);if(!async){if(xhr.status===200)
264 return xhr.responseText;return null;}
265 return null;}
266 function StringPool()
267 {this.reset();}
268 StringPool.prototype={intern:function(string)
269 {if(string==="__proto__")
270 return"__proto__";var result=this._strings[string];if(result===undefined){this._strings[string]=string;result=string;}
271 return result;},reset:function()
272 {this._strings=Object.create(null);},internObjectStrings:function(obj,depthLimit)
273 {if(typeof depthLimit!=="number")
274 depthLimit=100;else if(--depthLimit<0)
275 throw"recursion depth limit reached in StringPool.deepIntern(), perhaps attempting to traverse cyclical references?";for(var field in obj){switch(typeof obj[field]){case"string":obj[field]=this.intern(obj[field]);break;case"object":this.internObjectStrings(obj[field],depthLimit);break;}}}}
276 var _importedScripts={};function importScript(scriptName)
277 {if(_importedScripts[scriptName])
278 return;var xhr=new XMLHttpRequest();_importedScripts[scriptName]=true;xhr.open("GET",scriptName,false);xhr.send(null);if(!xhr.responseText)
279 throw"empty response arrived for script '"+scriptName+"'";var baseUrl=location.href;baseUrl=baseUrl.substring(0,baseUrl.lastIndexOf("/"));var sourceURL=baseUrl+"/"+scriptName;eval(xhr.responseText+"\n//# sourceURL="+sourceURL);}
280 var loadScript=importScript;function CallbackBarrier()
281 {this._pendingIncomingCallbacksCount=0;}
282 CallbackBarrier.prototype={createCallback:function(userCallback)
283 {console.assert(!this._outgoingCallback,"CallbackBarrier.createCallback() is called after CallbackBarrier.callWhenDone()");++this._pendingIncomingCallbacksCount;return this._incomingCallback.bind(this,userCallback);},callWhenDone:function(callback)
284 {console.assert(!this._outgoingCallback,"CallbackBarrier.callWhenDone() is called multiple times");this._outgoingCallback=callback;if(!this._pendingIncomingCallbacksCount)
285 this._outgoingCallback();},_incomingCallback:function(userCallback)
286 {console.assert(this._pendingIncomingCallbacksCount>0);if(userCallback){var args=Array.prototype.slice.call(arguments,1);userCallback.apply(null,args);}
287 if(!--this._pendingIncomingCallbacksCount&&this._outgoingCallback)
288 this._outgoingCallback();}}
289 __whitespace={" ":true,"\t":true,"\n":true,"\f":true,"\r":true};difflib={defaultJunkFunction:function(c){return __whitespace.hasOwnProperty(c);},stripLinebreaks:function(str){return str.replace(/^[\n\r]*|[\n\r]*$/g,"");},stringAsLines:function(str){var lfpos=str.indexOf("\n");var crpos=str.indexOf("\r");var linebreak=((lfpos>-1&&crpos>-1)||crpos<0)?"\n":"\r";var lines=str.split(linebreak);for(var i=0;i<lines.length;i++){lines[i]=difflib.stripLinebreaks(lines[i]);}
290 return lines;},__reduce:function(func,list,initial){if(initial!=null){var value=initial;var idx=0;}else if(list){var value=list[0];var idx=1;}else{return null;}
291 for(;idx<list.length;idx++){value=func(value,list[idx]);}
292 return value;},__ntuplecomp:function(a,b){var mlen=Math.max(a.length,b.length);for(var i=0;i<mlen;i++){if(a[i]<b[i])return-1;if(a[i]>b[i])return 1;}
293 return a.length==b.length?0:(a.length<b.length?-1:1);},__calculate_ratio:function(matches,length){return length?2.0*matches/length:1.0;},__isindict:function(dict){return function(key){return dict.hasOwnProperty(key);};},__dictget:function(dict,key,defaultValue){return dict.hasOwnProperty(key)?dict[key]:defaultValue;},SequenceMatcher:function(a,b,isjunk){this.set_seqs=function(a,b){this.set_seq1(a);this.set_seq2(b);}
294 this.set_seq1=function(a){if(a==this.a)return;this.a=a;this.matching_blocks=this.opcodes=null;}
295 this.set_seq2=function(b){if(b==this.b)return;this.b=b;this.matching_blocks=this.opcodes=this.fullbcount=null;this.__chain_b();}
296 this.__chain_b=function(){var b=this.b;var n=b.length;var b2j=this.b2j={};var populardict={};for(var i=0;i<b.length;i++){var elt=b[i];if(b2j.hasOwnProperty(elt)){var indices=b2j[elt];if(n>=200&&indices.length*100>n){populardict[elt]=1;delete b2j[elt];}else{indices.push(i);}}else{b2j[elt]=[i];}}
297 for(var elt in populardict){if(populardict.hasOwnProperty(elt)){delete b2j[elt];}}
298 var isjunk=this.isjunk;var junkdict={};if(isjunk){for(var elt in populardict){if(populardict.hasOwnProperty(elt)&&isjunk(elt)){junkdict[elt]=1;delete populardict[elt];}}
299 for(var elt in b2j){if(b2j.hasOwnProperty(elt)&&isjunk(elt)){junkdict[elt]=1;delete b2j[elt];}}}
300 this.isbjunk=difflib.__isindict(junkdict);this.isbpopular=difflib.__isindict(populardict);}
301 this.find_longest_match=function(alo,ahi,blo,bhi){var a=this.a;var b=this.b;var b2j=this.b2j;var isbjunk=this.isbjunk;var besti=alo;var bestj=blo;var bestsize=0;var j=null;var j2len={};var nothing=[];for(var i=alo;i<ahi;i++){var newj2len={};var jdict=difflib.__dictget(b2j,a[i],nothing);for(var jkey in jdict){if(jdict.hasOwnProperty(jkey)){j=jdict[jkey];if(j<blo)continue;if(j>=bhi)break;newj2len[j]=k=difflib.__dictget(j2len,j-1,0)+1;if(k>bestsize){besti=i-k+1;bestj=j-k+1;bestsize=k;}}}
302 j2len=newj2len;}
303 while(besti>alo&&bestj>blo&&!isbjunk(b[bestj-1])&&a[besti-1]==b[bestj-1]){besti--;bestj--;bestsize++;}
304 while(besti+bestsize<ahi&&bestj+bestsize<bhi&&!isbjunk(b[bestj+bestsize])&&a[besti+bestsize]==b[bestj+bestsize]){bestsize++;}
305 while(besti>alo&&bestj>blo&&isbjunk(b[bestj-1])&&a[besti-1]==b[bestj-1]){besti--;bestj--;bestsize++;}
306 while(besti+bestsize<ahi&&bestj+bestsize<bhi&&isbjunk(b[bestj+bestsize])&&a[besti+bestsize]==b[bestj+bestsize]){bestsize++;}
307 return[besti,bestj,bestsize];}
308 this.get_matching_blocks=function(){if(this.matching_blocks!=null)return this.matching_blocks;var la=this.a.length;var lb=this.b.length;var queue=[[0,la,0,lb]];var matching_blocks=[];var alo,ahi,blo,bhi,qi,i,j,k,x;while(queue.length){qi=queue.pop();alo=qi[0];ahi=qi[1];blo=qi[2];bhi=qi[3];x=this.find_longest_match(alo,ahi,blo,bhi);i=x[0];j=x[1];k=x[2];if(k){matching_blocks.push(x);if(alo<i&&blo<j)
309 queue.push([alo,i,blo,j]);if(i+k<ahi&&j+k<bhi)
310 queue.push([i+k,ahi,j+k,bhi]);}}
311 matching_blocks.sort(difflib.__ntuplecomp);var i1=j1=k1=block=0;var non_adjacent=[];for(var idx in matching_blocks){if(matching_blocks.hasOwnProperty(idx)){block=matching_blocks[idx];i2=block[0];j2=block[1];k2=block[2];if(i1+k1==i2&&j1+k1==j2){k1+=k2;}else{if(k1)non_adjacent.push([i1,j1,k1]);i1=i2;j1=j2;k1=k2;}}}
312 if(k1)non_adjacent.push([i1,j1,k1]);non_adjacent.push([la,lb,0]);this.matching_blocks=non_adjacent;return this.matching_blocks;}
313 this.get_opcodes=function(){if(this.opcodes!=null)return this.opcodes;var i=0;var j=0;var answer=[];this.opcodes=answer;var block,ai,bj,size,tag;var blocks=this.get_matching_blocks();for(var idx in blocks){if(blocks.hasOwnProperty(idx)){block=blocks[idx];ai=block[0];bj=block[1];size=block[2];tag='';if(i<ai&&j<bj){tag='replace';}else if(i<ai){tag='delete';}else if(j<bj){tag='insert';}
314 if(tag)answer.push([tag,i,ai,j,bj]);i=ai+size;j=bj+size;if(size)answer.push(['equal',ai,i,bj,j]);}}
315 return answer;}
316 this.get_grouped_opcodes=function(n){if(!n)n=3;var codes=this.get_opcodes();if(!codes)codes=[["equal",0,1,0,1]];var code,tag,i1,i2,j1,j2;if(codes[0][0]=='equal'){code=codes[0];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];codes[0]=[tag,Math.max(i1,i2-n),i2,Math.max(j1,j2-n),j2];}
317 if(codes[codes.length-1][0]=='equal'){code=codes[codes.length-1];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];codes[codes.length-1]=[tag,i1,Math.min(i2,i1+n),j1,Math.min(j2,j1+n)];}
318 var nn=n+n;var groups=[];for(var idx in codes){if(codes.hasOwnProperty(idx)){code=codes[idx];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];if(tag=='equal'&&i2-i1>nn){groups.push([tag,i1,Math.min(i2,i1+n),j1,Math.min(j2,j1+n)]);i1=Math.max(i1,i2-n);j1=Math.max(j1,j2-n);}
319 groups.push([tag,i1,i2,j1,j2]);}}
320 if(groups&&groups[groups.length-1][0]=='equal')groups.pop();return groups;}
321 this.ratio=function(){matches=difflib.__reduce(function(sum,triple){return sum+triple[triple.length-1];},this.get_matching_blocks(),0);return difflib.__calculate_ratio(matches,this.a.length+this.b.length);}
322 this.quick_ratio=function(){var fullbcount,elt;if(this.fullbcount==null){this.fullbcount=fullbcount={};for(var i=0;i<this.b.length;i++){elt=this.b[i];fullbcount[elt]=difflib.__dictget(fullbcount,elt,0)+1;}}
323 fullbcount=this.fullbcount;var avail={};var availhas=difflib.__isindict(avail);var matches=numb=0;for(var i=0;i<this.a.length;i++){elt=this.a[i];if(availhas(elt)){numb=avail[elt];}else{numb=difflib.__dictget(fullbcount,elt,0);}
324 avail[elt]=numb-1;if(numb>0)matches++;}
325 return difflib.__calculate_ratio(matches,this.a.length+this.b.length);}
326 this.real_quick_ratio=function(){var la=this.a.length;var lb=this.b.length;return _calculate_ratio(Math.min(la,lb),la+lb);}
327 this.isjunk=isjunk?isjunk:difflib.defaultJunkFunction;this.a=this.b=null;this.set_seqs(a,b);}}
328 Node.prototype.rangeOfWord=function(offset,stopCharacters,stayWithinNode,direction)
329 {var startNode;var startOffset=0;var endNode;var endOffset=0;if(!stayWithinNode)
330 stayWithinNode=this;if(!direction||direction==="backward"||direction==="both"){var node=this;while(node){if(node===stayWithinNode){if(!startNode)
331 startNode=stayWithinNode;break;}
332 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;}}}
333 if(startNode)
334 break;node=node.traversePreviousNode(stayWithinNode);}
335 if(!startNode){startNode=stayWithinNode;startOffset=0;}}else{startNode=this;startOffset=offset;}
336 if(!direction||direction==="forward"||direction==="both"){node=this;while(node){if(node===stayWithinNode){if(!endNode)
337 endNode=stayWithinNode;break;}
338 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;}}}
339 if(endNode)
340 break;node=node.traverseNextNode(stayWithinNode);}
341 if(!endNode){endNode=stayWithinNode;endOffset=stayWithinNode.nodeType===Node.TEXT_NODE?stayWithinNode.nodeValue.length:stayWithinNode.childNodes.length;}}else{endNode=this;endOffset=offset;}
342 var result=this.ownerDocument.createRange();result.setStart(startNode,startOffset);result.setEnd(endNode,endOffset);return result;}
343 Node.prototype.traverseNextTextNode=function(stayWithin)
344 {var node=this.traverseNextNode(stayWithin);if(!node)
345 return;while(node&&node.nodeType!==Node.TEXT_NODE)
346 node=node.traverseNextNode(stayWithin);return node;}
347 Node.prototype.rangeBoundaryForOffset=function(offset)
348 {var node=this.traverseNextTextNode(this);while(node&&offset>node.nodeValue.length){offset-=node.nodeValue.length;node=node.traverseNextTextNode(this);}
349 if(!node)
350 return{container:this,offset:0};return{container:node,offset:offset};}
351 Element.prototype.removeMatchingStyleClasses=function(classNameRegex)
352 {var regex=new RegExp("(^|\\s+)"+classNameRegex+"($|\\s+)");if(regex.test(this.className))
353 this.className=this.className.replace(regex," ");}
354 Element.prototype.enableStyleClass=function(className,enable)
355 {if(enable)
356 this.classList.add(className);else
357 this.classList.remove(className);}
358 Element.prototype.positionAt=function(x,y,relativeTo)
359 {var shift={x:0,y:0};if(relativeTo)
360 shift=relativeTo.boxInWindow(this.ownerDocument.defaultView);if(typeof x==="number")
361 this.style.setProperty("left",(shift.x+x)+"px");else
362 this.style.removeProperty("left");if(typeof y==="number")
363 this.style.setProperty("top",(shift.y+y)+"px");else
364 this.style.removeProperty("top");}
365 Element.prototype.isScrolledToBottom=function()
366 {return this.scrollTop+this.clientHeight===this.scrollHeight;}
367 function removeSubsequentNodes(fromNode,toNode)
368 {for(var node=fromNode;node&&node!==toNode;){var nodeToRemove=node;node=node.nextSibling;nodeToRemove.remove();}}
369 function Size(width,height)
370 {this.width=width;this.height=height;}
371 Element.prototype.measurePreferredSize=function(containerElement)
372 {containerElement=containerElement||document.body;containerElement.appendChild(this);this.positionAt(0,0);var result=new Size(this.offsetWidth,this.offsetHeight);this.positionAt(undefined,undefined);this.remove();return result;}
373 Element.prototype.containsEventPoint=function(event)
374 {var box=this.getBoundingClientRect();return box.left<event.x&&event.x<box.right&&box.top<event.y&&event.y<box.bottom;}
375 Node.prototype.enclosingNodeOrSelfWithNodeNameInArray=function(nameArray)
376 {for(var node=this;node&&node!==this.ownerDocument;node=node.parentNode)
377 for(var i=0;i<nameArray.length;++i)
378 if(node.nodeName.toLowerCase()===nameArray[i].toLowerCase())
379 return node;return null;}
380 Node.prototype.enclosingNodeOrSelfWithNodeName=function(nodeName)
381 {return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);}
382 Node.prototype.enclosingNodeOrSelfWithClass=function(className,stayWithin)
383 {for(var node=this;node&&node!==stayWithin&&node!==this.ownerDocument;node=node.parentNode)
384 if(node.nodeType===Node.ELEMENT_NODE&&node.classList.contains(className))
385 return node;return null;}
386 Element.prototype.query=function(query)
387 {return this.ownerDocument.evaluate(query,this,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}
388 Element.prototype.removeChildren=function()
389 {if(this.firstChild)
390 this.textContent="";}
391 Element.prototype.isInsertionCaretInside=function()
392 {var selection=window.getSelection();if(!selection.rangeCount||!selection.isCollapsed)
393 return false;var selectionRange=selection.getRangeAt(0);return selectionRange.startContainer.isSelfOrDescendant(this);}
394 Document.prototype.createElementWithClass=function(elementName,className)
395 {var element=this.createElement(elementName);if(className)
396 element.className=className;return element;}
397 Element.prototype.createChild=function(elementName,className)
398 {var element=this.ownerDocument.createElementWithClass(elementName,className);this.appendChild(element);return element;}
399 DocumentFragment.prototype.createChild=Element.prototype.createChild;Element.prototype.createTextChild=function(text)
400 {var element=this.ownerDocument.createTextNode(text);this.appendChild(element);return element;}
401 DocumentFragment.prototype.createTextChild=Element.prototype.createTextChild;Element.prototype.totalOffsetLeft=function()
402 {return this.totalOffset().left;}
403 Element.prototype.totalOffsetTop=function()
404 {return this.totalOffset().top;}
405 Element.prototype.totalOffset=function()
406 {var rect=this.getBoundingClientRect();return{left:rect.left,top:rect.top};}
407 Element.prototype.scrollOffset=function()
408 {var curLeft=0;var curTop=0;for(var element=this;element;element=element.scrollParent){curLeft+=element.scrollLeft;curTop+=element.scrollTop;}
409 return{left:curLeft,top:curTop};}
410 function AnchorBox(x,y,width,height)
411 {this.x=x||0;this.y=y||0;this.width=width||0;this.height=height||0;}
412 AnchorBox.prototype.relativeTo=function(box)
413 {return new AnchorBox(this.x-box.x,this.y-box.y,this.width,this.height);};AnchorBox.prototype.relativeToElement=function(element)
414 {return this.relativeTo(element.boxInWindow(element.ownerDocument.defaultView));};Element.prototype.offsetRelativeToWindow=function(targetWindow)
415 {var elementOffset=new AnchorBox();var curElement=this;var curWindow=this.ownerDocument.defaultView;while(curWindow&&curElement){elementOffset.x+=curElement.totalOffsetLeft();elementOffset.y+=curElement.totalOffsetTop();if(curWindow===targetWindow)
416 break;curElement=curWindow.frameElement;curWindow=curWindow.parent;}
417 return elementOffset;}
418 Element.prototype.boxInWindow=function(targetWindow)
419 {targetWindow=targetWindow||this.ownerDocument.defaultView;var anchorBox=this.offsetRelativeToWindow(window);anchorBox.width=Math.min(this.offsetWidth,window.innerWidth-anchorBox.x);anchorBox.height=Math.min(this.offsetHeight,window.innerHeight-anchorBox.y);return anchorBox;}
420 Element.prototype.setTextAndTitle=function(text)
421 {this.textContent=text;this.title=text;}
422 KeyboardEvent.prototype.__defineGetter__("data",function()
423 {switch(this.type){case"keypress":if(!this.ctrlKey&&!this.metaKey)
424 return String.fromCharCode(this.charCode);else
425 return"";case"keydown":case"keyup":if(!this.ctrlKey&&!this.metaKey&&!this.altKey)
426 return String.fromCharCode(this.which);else
427 return"";}});Event.prototype.consume=function(preventDefault)
428 {this.stopImmediatePropagation();if(preventDefault)
429 this.preventDefault();this.handled=true;}
430 Text.prototype.select=function(start,end)
431 {start=start||0;end=end||this.textContent.length;if(start<0)
432 start=end+start;var selection=this.ownerDocument.defaultView.getSelection();selection.removeAllRanges();var range=this.ownerDocument.createRange();range.setStart(this,start);range.setEnd(this,end);selection.addRange(range);return this;}
433 Element.prototype.selectionLeftOffset=function()
434 {var selection=window.getSelection();if(!selection.containsNode(this,true))
435 return null;var leftOffset=selection.anchorOffset;var node=selection.anchorNode;while(node!==this){while(node.previousSibling){node=node.previousSibling;leftOffset+=node.textContent.length;}
436 node=node.parentNode;}
437 return leftOffset;}
438 Node.prototype.isAncestor=function(node)
439 {if(!node)
440 return false;var currentNode=node.parentNode;while(currentNode){if(this===currentNode)
441 return true;currentNode=currentNode.parentNode;}
442 return false;}
443 Node.prototype.isDescendant=function(descendant)
444 {return!!descendant&&descendant.isAncestor(this);}
445 Node.prototype.isSelfOrAncestor=function(node)
446 {return!!node&&(node===this||this.isAncestor(node));}
447 Node.prototype.isSelfOrDescendant=function(node)
448 {return!!node&&(node===this||this.isDescendant(node));}
449 Node.prototype.traverseNextNode=function(stayWithin)
450 {var node=this.firstChild;if(node)
451 return node;if(stayWithin&&this===stayWithin)
452 return null;node=this.nextSibling;if(node)
453 return node;node=this;while(node&&!node.nextSibling&&(!stayWithin||!node.parentNode||node.parentNode!==stayWithin))
454 node=node.parentNode;if(!node)
455 return null;return node.nextSibling;}
456 Node.prototype.traversePreviousNode=function(stayWithin)
457 {if(stayWithin&&this===stayWithin)
458 return null;var node=this.previousSibling;while(node&&node.lastChild)
459 node=node.lastChild;if(node)
460 return node;return this.parentNode;}
461 function isEnterKey(event){return event.keyCode!==229&&event.keyIdentifier==="Enter";}
462 function consumeEvent(e)
463 {e.consume();}
464 function NonLeakingMutationObserver(handler)
465 {this._observer=new WebKitMutationObserver(handler);NonLeakingMutationObserver._instances.push(this);if(!NonLeakingMutationObserver._unloadListener){NonLeakingMutationObserver._unloadListener=function(){while(NonLeakingMutationObserver._instances.length)
466 NonLeakingMutationObserver._instances[NonLeakingMutationObserver._instances.length-1].disconnect();};window.addEventListener("unload",NonLeakingMutationObserver._unloadListener,false);}}
467 NonLeakingMutationObserver._instances=[];NonLeakingMutationObserver.prototype={observe:function(element,config)
468 {if(this._observer)
469 this._observer.observe(element,config);},disconnect:function()
470 {if(this._observer)
471 this._observer.disconnect();NonLeakingMutationObserver._instances.remove(this);delete this._observer;}}
472 function TreeOutline(listNode,nonFocusable)
473 {this.children=[];this.selectedTreeElement=null;this._childrenListNode=listNode;this.childrenListElement=this._childrenListNode;this._childrenListNode.removeChildren();this.expandTreeElementsWhenArrowing=false;this.root=true;this.hasChildren=false;this.expanded=true;this.selected=false;this.treeOutline=this;this.comparator=null;this.setFocusable(!nonFocusable);this._childrenListNode.addEventListener("keydown",this._treeKeyDown.bind(this),true);this._treeElementsMap=new Map();this._expandedStateMap=new Map();}
474 TreeOutline.prototype.setFocusable=function(focusable)
475 {if(focusable)
476 this._childrenListNode.setAttribute("tabIndex",0);else
477 this._childrenListNode.removeAttribute("tabIndex");}
478 TreeOutline.prototype.appendChild=function(child)
479 {var insertionIndex;if(this.treeOutline.comparator)
480 insertionIndex=insertionIndexForObjectInListSortedByFunction(child,this.children,this.treeOutline.comparator);else
481 insertionIndex=this.children.length;this.insertChild(child,insertionIndex);}
482 TreeOutline.prototype.insertBeforeChild=function(child,beforeChild)
483 {if(!child)
484 throw("child can't be undefined or null");if(!beforeChild)
485 throw("beforeChild can't be undefined or null");var childIndex=this.children.indexOf(beforeChild);if(childIndex===-1)
486 throw("beforeChild not found in this node's children");this.insertChild(child,childIndex);}
487 TreeOutline.prototype.insertChild=function(child,index)
488 {if(!child)
489 throw("child can't be undefined or null");var previousChild=(index>0?this.children[index-1]:null);if(previousChild){previousChild.nextSibling=child;child.previousSibling=previousChild;}else{child.previousSibling=null;}
490 var nextChild=this.children[index];if(nextChild){nextChild.previousSibling=child;child.nextSibling=nextChild;}else{child.nextSibling=null;}
491 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);}
492 if(child.hasChildren&&typeof(child.treeOutline._expandedStateMap.get(child.representedObject))!=="undefined")
493 child.expanded=child.treeOutline._expandedStateMap.get(child.representedObject);if(!this._childrenListNode){this._childrenListNode=this.treeOutline._childrenListNode.ownerDocument.createElement("ol");this._childrenListNode.parentTreeElement=this;this._childrenListNode.classList.add("children");if(this.hidden)
494 this._childrenListNode.classList.add("hidden");}
495 child._attach();}
496 TreeOutline.prototype.removeChildAtIndex=function(childIndex)
497 {if(childIndex<0||childIndex>=this.children.length)
498 throw("childIndex out of range");var child=this.children[childIndex];this.children.splice(childIndex,1);var parent=child.parent;if(child.deselect()){if(child.previousSibling)
499 child.previousSibling.select();else if(child.nextSibling)
500 child.nextSibling.select();else
501 parent.select();}
502 if(child.previousSibling)
503 child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
504 child.nextSibling.previousSibling=child.previousSibling;if(child.treeOutline){child.treeOutline._forgetTreeElement(child);child.treeOutline._forgetChildrenRecursive(child);}
505 child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
506 TreeOutline.prototype.removeChild=function(child)
507 {if(!child)
508 throw("child can't be undefined or null");var childIndex=this.children.indexOf(child);if(childIndex===-1)
509 throw("child not found in this node's children");this.removeChildAtIndex.call(this,childIndex);}
510 TreeOutline.prototype.removeChildren=function()
511 {for(var i=0;i<this.children.length;++i){var child=this.children[i];child.deselect();if(child.treeOutline){child.treeOutline._forgetTreeElement(child);child.treeOutline._forgetChildrenRecursive(child);}
512 child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
513 this.children=[];}
514 TreeOutline.prototype._rememberTreeElement=function(element)
515 {if(!this._treeElementsMap.get(element.representedObject))
516 this._treeElementsMap.put(element.representedObject,[]);var elements=this._treeElementsMap.get(element.representedObject);if(elements.indexOf(element)!==-1)
517 return;elements.push(element);}
518 TreeOutline.prototype._forgetTreeElement=function(element)
519 {if(this._treeElementsMap.get(element.representedObject)){var elements=this._treeElementsMap.get(element.representedObject);elements.remove(element,true);if(!elements.length)
520 this._treeElementsMap.remove(element.representedObject);}}
521 TreeOutline.prototype._forgetChildrenRecursive=function(parentElement)
522 {var child=parentElement.children[0];while(child){this._forgetTreeElement(child);child=child.traverseNextTreeElement(false,parentElement,true);}}
523 TreeOutline.prototype.getCachedTreeElement=function(representedObject)
524 {if(!representedObject)
525 return null;var elements=this._treeElementsMap.get(representedObject);if(elements&&elements.length)
526 return elements[0];return null;}
527 TreeOutline.prototype.findTreeElement=function(representedObject,isAncestor,getParent)
528 {if(!representedObject)
529 return null;var cachedElement=this.getCachedTreeElement(representedObject);if(cachedElement)
530 return cachedElement;var ancestors=[];for(var currentObject=getParent(representedObject);currentObject;currentObject=getParent(currentObject)){ancestors.push(currentObject);if(this.getCachedTreeElement(currentObject))
531 break;}
532 if(!currentObject)
533 return null;for(var i=ancestors.length-1;i>=0;--i){var treeElement=this.getCachedTreeElement(ancestors[i]);if(treeElement)
534 treeElement.onpopulate();}
535 return this.getCachedTreeElement(representedObject);}
536 TreeOutline.prototype.treeElementFromPoint=function(x,y)
537 {var node=this._childrenListNode.ownerDocument.elementFromPoint(x,y);if(!node)
538 return null;var listNode=node.enclosingNodeOrSelfWithNodeNameInArray(["ol","li"]);if(listNode)
539 return listNode.parentTreeElement||listNode.treeElement;return null;}
540 TreeOutline.prototype._treeKeyDown=function(event)
541 {if(event.target!==this._childrenListNode)
542 return;if(!this.selectedTreeElement||event.shiftKey||event.metaKey||event.ctrlKey)
543 return;var handled=false;var nextSelectedElement;if(event.keyIdentifier==="Up"&&!event.altKey){nextSelectedElement=this.selectedTreeElement.traversePreviousTreeElement(true);while(nextSelectedElement&&!nextSelectedElement.selectable)
544 nextSelectedElement=nextSelectedElement.traversePreviousTreeElement(!this.expandTreeElementsWhenArrowing);handled=nextSelectedElement?true:false;}else if(event.keyIdentifier==="Down"&&!event.altKey){nextSelectedElement=this.selectedTreeElement.traverseNextTreeElement(true);while(nextSelectedElement&&!nextSelectedElement.selectable)
545 nextSelectedElement=nextSelectedElement.traverseNextTreeElement(!this.expandTreeElementsWhenArrowing);handled=nextSelectedElement?true:false;}else if(event.keyIdentifier==="Left"){if(this.selectedTreeElement.expanded){if(event.altKey)
546 this.selectedTreeElement.collapseRecursively();else
547 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)
548 nextSelectedElement=nextSelectedElement.parent;handled=nextSelectedElement?true:false;}else if(this.selectedTreeElement.parent)
549 this.selectedTreeElement.parent.collapse();}}else if(event.keyIdentifier==="Right"){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)
550 nextSelectedElement=nextSelectedElement.nextSibling;handled=nextSelectedElement?true:false;}else{if(event.altKey)
551 this.selectedTreeElement.expandRecursively();else
552 this.selectedTreeElement.expand();}}}else if(event.keyCode===8||event.keyCode===46)
553 handled=this.selectedTreeElement.ondelete();else if(isEnterKey(event))
554 handled=this.selectedTreeElement.onenter();else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Space.code)
555 handled=this.selectedTreeElement.onspace();if(nextSelectedElement){nextSelectedElement.reveal();nextSelectedElement.select(false,true);}
556 if(handled)
557 event.consume(true);}
558 TreeOutline.prototype.expand=function()
559 {}
560 TreeOutline.prototype.collapse=function()
561 {}
562 TreeOutline.prototype.revealed=function()
563 {return true;}
564 TreeOutline.prototype.reveal=function()
565 {}
566 TreeOutline.prototype.select=function()
567 {}
568 TreeOutline.prototype.revealAndSelect=function(omitFocus)
569 {}
570 function TreeElement(title,representedObject,hasChildren)
571 {this._title=title;this.representedObject=(representedObject||{});this.root=false;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;}
572 TreeElement.prototype={arrowToggleWidth:10,get selectable(){if(this._hidden)
573 return false;return this._selectable;},set selectable(x){this._selectable=x;},get listItemElement(){return this._listItemNode;},get childrenListElement(){return this._childrenListNode;},get title(){return this._title;},set title(x){this._title=x;this._setListItemNodeContent();},get tooltip(){return this._tooltip;},set tooltip(x){this._tooltip=x;if(this._listItemNode)
574 this._listItemNode.title=x?x:"";},get hasChildren(){return this._hasChildren;},set hasChildren(x){if(this._hasChildren===x)
575 return;this._hasChildren=x;if(!this._listItemNode)
576 return;if(x)
577 this._listItemNode.classList.add("parent");else{this._listItemNode.classList.remove("parent");this.collapse();}},get hidden(){return this._hidden;},set hidden(x){if(this._hidden===x)
578 return;this._hidden=x;if(x){if(this._listItemNode)
579 this._listItemNode.classList.add("hidden");if(this._childrenListNode)
580 this._childrenListNode.classList.add("hidden");}else{if(this._listItemNode)
581 this._listItemNode.classList.remove("hidden");if(this._childrenListNode)
582 this._childrenListNode.classList.remove("hidden");}},get shouldRefreshChildren(){return this._shouldRefreshChildren;},set shouldRefreshChildren(x){this._shouldRefreshChildren=x;if(x&&this.expanded)
583 this.expand();},_setListItemNodeContent:function()
584 {if(!this._listItemNode)
585 return;if(typeof this._title==="string")
586 this._listItemNode.textContent=this._title;else{this._listItemNode.removeChildren();if(this._title)
587 this._listItemNode.appendChild(this._title);}}}
588 TreeElement.prototype.appendChild=TreeOutline.prototype.appendChild;TreeElement.prototype.insertChild=TreeOutline.prototype.insertChild;TreeElement.prototype.insertBeforeChild=TreeOutline.prototype.insertBeforeChild;TreeElement.prototype.removeChild=TreeOutline.prototype.removeChild;TreeElement.prototype.removeChildAtIndex=TreeOutline.prototype.removeChildAtIndex;TreeElement.prototype.removeChildren=TreeOutline.prototype.removeChildren;TreeElement.prototype._attach=function()
589 {if(!this._listItemNode||this.parent._shouldRefreshChildren){if(this._listItemNode&&this._listItemNode.parentNode)
590 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:"";if(this.hidden)
591 this._listItemNode.classList.add("hidden");if(this.hasChildren)
592 this._listItemNode.classList.add("parent");if(this.expanded)
593 this._listItemNode.classList.add("expanded");if(this.selected)
594 this._listItemNode.classList.add("selected");this._listItemNode.addEventListener("mousedown",TreeElement.treeElementMouseDown,false);this._listItemNode.addEventListener("click",TreeElement.treeElementToggled,false);this._listItemNode.addEventListener("dblclick",TreeElement.treeElementDoubleClicked,false);this.onattach();}
595 var nextSibling=null;if(this.nextSibling&&this.nextSibling._listItemNode&&this.nextSibling._listItemNode.parentNode===this.parent._childrenListNode)
596 nextSibling=this.nextSibling._listItemNode;this.parent._childrenListNode.insertBefore(this._listItemNode,nextSibling);if(this._childrenListNode)
597 this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);if(this.selected)
598 this.select();if(this.expanded)
599 this.expand();}
600 TreeElement.prototype._detach=function()
601 {if(this._listItemNode&&this._listItemNode.parentNode)
602 this._listItemNode.parentNode.removeChild(this._listItemNode);if(this._childrenListNode&&this._childrenListNode.parentNode)
603 this._childrenListNode.parentNode.removeChild(this._childrenListNode);}
604 TreeElement.treeElementMouseDown=function(event)
605 {var element=event.currentTarget;if(!element||!element.treeElement||!element.treeElement.selectable)
606 return;if(element.treeElement.isEventWithinDisclosureTriangle(event))
607 return;element.treeElement.selectOnMouseDown(event);}
608 TreeElement.treeElementToggled=function(event)
609 {var element=event.currentTarget;if(!element||!element.treeElement)
610 return;var toggleOnClick=element.treeElement.toggleOnClick&&!element.treeElement.selectable;var isInTriangle=element.treeElement.isEventWithinDisclosureTriangle(event);if(!toggleOnClick&&!isInTriangle)
611 return;if(element.treeElement.expanded){if(event.altKey)
612 element.treeElement.collapseRecursively();else
613 element.treeElement.collapse();}else{if(event.altKey)
614 element.treeElement.expandRecursively();else
615 element.treeElement.expand();}
616 event.consume();}
617 TreeElement.treeElementDoubleClicked=function(event)
618 {var element=event.currentTarget;if(!element||!element.treeElement)
619 return;var handled=element.treeElement.ondblclick.call(element.treeElement,event);if(handled)
620 return;if(element.treeElement.hasChildren&&!element.treeElement.expanded)
621 element.treeElement.expand();}
622 TreeElement.prototype.collapse=function()
623 {if(this._listItemNode)
624 this._listItemNode.classList.remove("expanded");if(this._childrenListNode)
625 this._childrenListNode.classList.remove("expanded");this.expanded=false;if(this.treeOutline)
626 this.treeOutline._expandedStateMap.put(this.representedObject,false);this.oncollapse();}
627 TreeElement.prototype.collapseRecursively=function()
628 {var item=this;while(item){if(item.expanded)
629 item.collapse();item=item.traverseNextTreeElement(false,this,true);}}
630 TreeElement.prototype.expand=function()
631 {if(!this.hasChildren||(this.expanded&&!this._shouldRefreshChildren&&this._childrenListNode))
632 return;this.expanded=true;if(this.treeOutline)
633 this.treeOutline._expandedStateMap.put(this.representedObject,true);if(this.treeOutline&&(!this._childrenListNode||this._shouldRefreshChildren)){if(this._childrenListNode&&this._childrenListNode.parentNode)
634 this._childrenListNode.parentNode.removeChild(this._childrenListNode);this._childrenListNode=this.treeOutline._childrenListNode.ownerDocument.createElement("ol");this._childrenListNode.parentTreeElement=this;this._childrenListNode.classList.add("children");if(this.hidden)
635 this._childrenListNode.classList.add("hidden");this.onpopulate();for(var i=0;i<this.children.length;++i)
636 this.children[i]._attach();delete this._shouldRefreshChildren;}
637 if(this._listItemNode){this._listItemNode.classList.add("expanded");if(this._childrenListNode&&this._childrenListNode.parentNode!=this._listItemNode.parentNode)
638 this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);}
639 if(this._childrenListNode)
640 this._childrenListNode.classList.add("expanded");this.onexpand();}
641 TreeElement.prototype.expandRecursively=function(maxDepth)
642 {var item=this;var info={};var depth=0;if(isNaN(maxDepth))
643 maxDepth=3;while(item){if(depth<maxDepth)
644 item.expand();item=item.traverseNextTreeElement(false,this,(depth>=maxDepth),info);depth+=info.depthChange;}}
645 TreeElement.prototype.hasAncestor=function(ancestor){if(!ancestor)
646 return false;var currentNode=this.parent;while(currentNode){if(ancestor===currentNode)
647 return true;currentNode=currentNode.parent;}
648 return false;}
649 TreeElement.prototype.reveal=function()
650 {var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
651 currentAncestor.expand();currentAncestor=currentAncestor.parent;}
652 this.onreveal();}
653 TreeElement.prototype.revealed=function()
654 {var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
655 return false;currentAncestor=currentAncestor.parent;}
656 return true;}
657 TreeElement.prototype.selectOnMouseDown=function(event)
658 {if(this.select(false,true))
659 event.consume(true);}
660 TreeElement.prototype.select=function(omitFocus,selectedByUser)
661 {if(!this.treeOutline||!this.selectable||this.selected)
662 return false;if(this.treeOutline.selectedTreeElement)
663 this.treeOutline.selectedTreeElement.deselect();this.selected=true;if(!omitFocus)
664 this.treeOutline._childrenListNode.focus();if(!this.treeOutline)
665 return false;this.treeOutline.selectedTreeElement=this;if(this._listItemNode)
666 this._listItemNode.classList.add("selected");return this.onselect(selectedByUser);}
667 TreeElement.prototype.revealAndSelect=function(omitFocus)
668 {this.reveal();this.select(omitFocus);}
669 TreeElement.prototype.deselect=function(supressOnDeselect)
670 {if(!this.treeOutline||this.treeOutline.selectedTreeElement!==this||!this.selected)
671 return false;this.selected=false;this.treeOutline.selectedTreeElement=null;if(this._listItemNode)
672 this._listItemNode.classList.remove("selected");return true;}
673 TreeElement.prototype.onpopulate=function(){}
674 TreeElement.prototype.onenter=function(){return false;}
675 TreeElement.prototype.ondelete=function(){return false;}
676 TreeElement.prototype.onspace=function(){return false;}
677 TreeElement.prototype.onattach=function(){}
678 TreeElement.prototype.onexpand=function(){}
679 TreeElement.prototype.oncollapse=function(){}
680 TreeElement.prototype.ondblclick=function(e){return false;}
681 TreeElement.prototype.onreveal=function(){}
682 TreeElement.prototype.onselect=function(selectedByUser){return false;}
683 TreeElement.prototype.traverseNextTreeElement=function(skipUnrevealed,stayWithin,dontPopulate,info)
684 {if(!dontPopulate&&this.hasChildren)
685 this.onpopulate();if(info)
686 info.depthChange=0;var element=skipUnrevealed?(this.revealed()?this.children[0]:null):this.children[0];if(element&&(!skipUnrevealed||(skipUnrevealed&&this.expanded))){if(info)
687 info.depthChange=1;return element;}
688 if(this===stayWithin)
689 return null;element=skipUnrevealed?(this.revealed()?this.nextSibling:null):this.nextSibling;if(element)
690 return element;element=this;while(element&&!element.root&&!(skipUnrevealed?(element.revealed()?element.nextSibling:null):element.nextSibling)&&element.parent!==stayWithin){if(info)
691 info.depthChange-=1;element=element.parent;}
692 if(!element)
693 return null;return(skipUnrevealed?(element.revealed()?element.nextSibling:null):element.nextSibling);}
694 TreeElement.prototype.traversePreviousTreeElement=function(skipUnrevealed,dontPopulate)
695 {var element=skipUnrevealed?(this.revealed()?this.previousSibling:null):this.previousSibling;if(!dontPopulate&&element&&element.hasChildren)
696 element.onpopulate();while(element&&(skipUnrevealed?(element.revealed()&&element.expanded?element.children[element.children.length-1]:null):element.children[element.children.length-1])){if(!dontPopulate&&element.hasChildren)
697 element.onpopulate();element=(skipUnrevealed?(element.revealed()&&element.expanded?element.children[element.children.length-1]:null):element.children[element.children.length-1]);}
698 if(element)
699 return element;if(!this.parent||this.parent.root)
700 return null;return this.parent;}
701 TreeElement.prototype.isEventWithinDisclosureTriangle=function(event)
702 {var paddingLeftValue=window.getComputedStyle(this._listItemNode).getPropertyCSSValue("padding-left");var computedLeftPadding=paddingLeftValue?paddingLeftValue.getFloatValue(CSSPrimitiveValue.CSS_PX):0;var left=this._listItemNode.totalOffsetLeft()+computedLeftPadding;return event.pageX>=left&&event.pageX<=left+this.arrowToggleWidth&&this.hasChildren;}
703 var WebInspector={_registerPanelModules:function()
704 {if(!WebInspector.WorkerManager.isWorkerFrontend())
705 new WebInspector.ElementsPanelDescriptor();if(!WebInspector.WorkerManager.isWorkerFrontend())
706 new WebInspector.NetworkPanelDescriptor();new WebInspector.SourcesPanelDescriptor();new WebInspector.TimelinePanelDescriptor();new WebInspector.ProfilesPanelDescriptor();if(!WebInspector.WorkerManager.isWorkerFrontend()){WebInspector.moduleManager.registerModule({name:"ResourcesPanel",extensions:[{type:"@WebInspector.Panel",name:"resources",title:"Resources",order:5,className:"WebInspector.ResourcesPanel"}],scripts:["ResourcesPanel.js"]});}
707 if(!WebInspector.WorkerManager.isWorkerFrontend())
708 new WebInspector.AuditsPanelDescriptor();WebInspector.moduleManager.registerModule({name:"ConsolePanel",extensions:[{type:"@WebInspector.Panel",name:"console",title:"Console",order:10,className:"WebInspector.ConsolePanel"},{type:"@WebInspector.Drawer.ViewFactory",name:"console",title:"Console",order:"0",className:"WebInspector.ConsolePanel.ViewFactory"}]});if(WebInspector.experimentsSettings.layersPanel.isEnabled()&&!WebInspector.WorkerManager.isWorkerFrontend())
709 new WebInspector.LayersPanelDescriptor();},_createGlobalStatusBarItems:function()
710 {if(this.inspectElementModeController)
711 this.inspectorView.appendToLeftToolbar(this.inspectElementModeController.toggleSearchButton.element);this.inspectorView.appendToRightToolbar(this.settingsController.statusBarItem);if(this.dockController.element)
712 this.inspectorView.appendToRightToolbar(this.dockController.element);if(Capabilities.canScreencast){var placeholder=document.createElement("div");this._screencastView=new WebInspector.ScreencastView(placeholder);this.inspectorView.appendToRightToolbar(placeholder);}},isInspectingDevice:function()
713 {return!!WebInspector.queryParamsObject["remoteFrontend"];},showConsole:function()
714 {if(this.consoleView.isShowing()&&!WebInspector.inspectorView.drawer().isHiding())
715 return;this.inspectorView.showViewInDrawer("console");},_resetErrorAndWarningCounts:function()
716 {WebInspector.inspectorView.setErrorAndWarningCounts(0,0);},_updateErrorAndWarningCounts:function()
717 {var errors=WebInspector.console.errors;var warnings=WebInspector.console.warnings;WebInspector.inspectorView.setErrorAndWarningCounts(errors,warnings);},get inspectedPageDomain()
718 {var parsedURL=WebInspector.inspectedPageURL&&WebInspector.inspectedPageURL.asParsedURL();return parsedURL?parsedURL.host:"";},_initializeCapability:function(name,callback,error,result)
719 {Capabilities[name]=result;if(callback)
720 callback();},_zoomIn:function()
721 {this._zoomLevel=Math.min(this._zoomLevel+1,WebInspector.Zoom.Table.length-WebInspector.Zoom.DefaultOffset-1);this._requestZoom();},_zoomOut:function()
722 {this._zoomLevel=Math.max(this._zoomLevel-1,-WebInspector.Zoom.DefaultOffset);this._requestZoom();},_resetZoom:function()
723 {this._zoomLevel=0;this._requestZoom();},_adjustExternalZoomFactor:function()
724 {var realZoomFactor=InspectorFrontendHost.zoomFactor();var expectedZoomFactor=this.zoomFactor();if(Math.abs(realZoomFactor-expectedZoomFactor)>1e-3){WebInspector.settings.externalZoomFactor.set(realZoomFactor);this._requestZoom();}},zoomFactor:function()
725 {var index=this._zoomLevel+WebInspector.Zoom.DefaultOffset;index=Math.min(WebInspector.Zoom.Table.length-1,index);index=Math.max(0,index);return WebInspector.Zoom.Table[index]*WebInspector.settings.externalZoomFactor.get();},_requestZoom:function()
726 {WebInspector.settings.zoomLevel.set(this._zoomLevel);InspectorFrontendHost.setZoomFactor(this.zoomFactor());},_debuggerPaused:function()
727 {this.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPaused,this);WebInspector.showPanel("sources");}}
728 WebInspector.Events={InspectorLoaded:"InspectorLoaded"}
729 {(function parseQueryParameters()
730 {WebInspector.queryParamsObject={};var queryParams=window.location.search;if(!queryParams)
731 return;var params=queryParams.substring(1).split("&");for(var i=0;i<params.length;++i){var pair=params[i].split("=");WebInspector.queryParamsObject[pair[0]]=pair[1];}})();}
732 WebInspector.suggestReload=function()
733 {if(window.confirm(WebInspector.UIString("It is recommended to restart inspector after making these changes. Would you like to restart it?")))
734 this.reload();}
735 WebInspector.reload=function()
736 {InspectorAgent.reset();var queryParams=window.location.search;var url=window.location.href;url=url.substring(0,url.length-queryParams.length);var queryParamsObject={};for(var name in WebInspector.queryParamsObject)
737 queryParamsObject[name]=WebInspector.queryParamsObject[name];if(this.dockController)
738 queryParamsObject["dockSide"]=this.dockController.dockSide();var names=Object.keys(queryParamsObject);for(var i=0;i<names.length;++i)
739 url+=(i?"&":"?")+names[i]+"="+queryParamsObject[names[i]];document.location=url;}
740 WebInspector.loaded=function()
741 {if(!InspectorFrontendHost.sendMessageToEmbedder){var helpScreen=new WebInspector.HelpScreen(WebInspector.UIString("Incompatible Chrome version"));var p=helpScreen.contentElement.createChild("p","help-section");p.textContent=WebInspector.UIString("Please upgrade to a newer Chrome version (you might need a Dev or Canary build).");helpScreen.showModal();return;}
742 InspectorBackend.loadFromJSONIfNeeded("../protocol.json");WebInspector.dockController=new WebInspector.DockController();if(WebInspector.WorkerManager.isDedicatedWorkerFrontend()){WebInspector.doLoadedDone();return;}
743 var ws;if("ws"in WebInspector.queryParamsObject)
744 ws="ws://"+WebInspector.queryParamsObject.ws;else if("page"in WebInspector.queryParamsObject){var page=WebInspector.queryParamsObject.page;var host="host"in WebInspector.queryParamsObject?WebInspector.queryParamsObject.host:window.location.host;ws="ws://"+host+"/devtools/page/"+page;}
745 if(ws){WebInspector.socket=new WebSocket(ws);WebInspector.socket.onmessage=function(message){InspectorBackend.dispatch(message.data);}
746 WebInspector.socket.onerror=function(error){console.error(error);}
747 WebInspector.socket.onopen=function(){InspectorFrontendHost.sendMessageToBackend=WebInspector.socket.send.bind(WebInspector.socket);WebInspector.doLoadedDone();}
748 WebInspector.socket.onclose=function(){if(!WebInspector.socket._detachReason)
749 (new WebInspector.RemoteDebuggingTerminatedScreen("websocket_closed")).showModal();}
750 return;}
751 WebInspector.doLoadedDone();if(InspectorFrontendHost.isStub){InspectorFrontendAPI.dispatchQueryParameters(WebInspector.queryParamsObject);WebInspector._doLoadedDoneWithCapabilities();}}
752 WebInspector.doLoadedDone=function()
753 {WebInspector.installPortStyles();if(WebInspector.socket)
754 document.body.classList.add("remote");if(WebInspector.queryParamsObject.toolbarColor&&WebInspector.queryParamsObject.textColor)
755 WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbarColor,WebInspector.queryParamsObject.textColor);WebInspector.WorkerManager.loaded();PageAgent.canScreencast(WebInspector._initializeCapability.bind(WebInspector,"canScreencast",null));WorkerAgent.canInspectWorkers(WebInspector._initializeCapability.bind(WebInspector,"canInspectWorkers",WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector)));}
756 WebInspector._doLoadedDoneWithCapabilities=function()
757 {new WebInspector.VersionController().updateVersion();WebInspector.shortcutsScreen=new WebInspector.ShortcutsScreen();this._registerShortcuts();WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));WebInspector.ShortcutsScreen.registerShortcuts();this.console=new WebInspector.ConsoleModel();this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._resetErrorAndWarningCounts,this);this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._updateErrorAndWarningCounts,this);this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated,this._updateErrorAndWarningCounts,this);this.networkManager=new WebInspector.NetworkManager();this.resourceTreeModel=new WebInspector.ResourceTreeModel(this.networkManager);this.debuggerModel=new WebInspector.DebuggerModel();this.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPaused,this);this.networkLog=new WebInspector.NetworkLog();this.domAgent=new WebInspector.DOMAgent();this.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectNodeRequested,this._inspectNodeRequested,this);this.runtimeModel=new WebInspector.RuntimeModel(this.resourceTreeModel);this._zoomLevel=WebInspector.settings.zoomLevel.get();WebInspector.settings.externalZoomFactor.set(InspectorFrontendHost.zoomFactor());if(this._zoomLevel)
758 this._requestZoom();this.advancedSearchController=new WebInspector.AdvancedSearchController();WebInspector.CSSMetadata.requestCSSShorthandData();this.consoleView=new WebInspector.ConsoleView(WebInspector.WorkerManager.isWorkerFrontend());InspectorBackend.registerInspectorDispatcher(this);this.isolatedFileSystemManager=new WebInspector.IsolatedFileSystemManager();this.isolatedFileSystemDispatcher=new WebInspector.IsolatedFileSystemDispatcher(this.isolatedFileSystemManager);this.workspace=new WebInspector.Workspace(this.isolatedFileSystemManager.mapping());this.cssModel=new WebInspector.CSSStyleModel(this.workspace);this.timelineManager=new WebInspector.TimelineManager();this.tracingAgent=new WebInspector.TracingAgent();if(!WebInspector.WorkerManager.isWorkerFrontend())
759 this.inspectElementModeController=new WebInspector.InspectElementModeController();this.settingsController=new WebInspector.SettingsController();this.domBreakpointsSidebarPane=new WebInspector.DOMBreakpointsSidebarPane();var autoselectPanel=WebInspector.UIString("a panel chosen automatically");var openAnchorLocationSetting=WebInspector.settings.createSetting("openLinkHandler",autoselectPanel);this.openAnchorLocationRegistry=new WebInspector.HandlerRegistry(openAnchorLocationSetting);this.openAnchorLocationRegistry.registerHandler(autoselectPanel,function(){return false;});new WebInspector.WorkspaceController(this.workspace);this.fileSystemWorkspaceProvider=new WebInspector.FileSystemWorkspaceProvider(this.isolatedFileSystemManager,this.workspace);this.networkWorkspaceProvider=new WebInspector.SimpleWorkspaceProvider(this.workspace,WebInspector.projectTypes.Network);new WebInspector.NetworkUISourceCodeProvider(this.networkWorkspaceProvider,this.workspace);this.breakpointManager=new WebInspector.BreakpointManager(WebInspector.settings.breakpoints,this.debuggerModel,this.workspace);this.scriptSnippetModel=new WebInspector.ScriptSnippetModel(this.workspace);this.overridesSupport=new WebInspector.OverridesSupport();this.overridesSupport.applyInitialOverrides();new WebInspector.DebuggerScriptMapping(this.workspace,this.networkWorkspaceProvider);this.liveEditSupport=new WebInspector.LiveEditSupport(this.workspace);new WebInspector.CSSStyleSheetMapping(this.cssModel,this.workspace,this.networkWorkspaceProvider);new WebInspector.PresentationConsoleMessageHelper(this.workspace);WebInspector.settings.initializeBackendSettings();this._registerPanelModules();this.panels={};WebInspector.inspectorView=new WebInspector.InspectorView();WebInspector.inspectorView.show(document.body);this._createGlobalStatusBarItems();if(this.overridesSupport.hasActiveOverrides()){if(!WebInspector.settings.showEmulationViewInDrawer.get())
760 WebInspector.settings.showEmulationViewInDrawer.set(true);WebInspector.inspectorView.showViewInDrawer("emulation");}
761 this.addMainEventListeners(document);window.addEventListener("resize",this.windowResize.bind(this),true);var errorWarningCount=document.getElementById("error-warning-count");errorWarningCount.addEventListener("click",this.showConsole.bind(this),false);this._updateErrorAndWarningCounts();this.extensionServer.initExtensions();this.console.enableAgent();InspectorAgent.enable(WebInspector.inspectorView.showInitialPanel.bind(WebInspector.inspectorView));this.databaseModel=new WebInspector.DatabaseModel();this.domStorageModel=new WebInspector.DOMStorageModel();this.cpuProfilerModel=new WebInspector.CPUProfilerModel();HeapProfilerAgent.enable();if(WebInspector.settings.showPaintRects.get()||WebInspector.settings.showDebugBorders.get()||WebInspector.settings.continuousPainting.get()||WebInspector.settings.showFPSCounter.get()||WebInspector.settings.showScrollBottleneckRects.get()){WebInspector.settings.showRenderingViewInDrawer.set(true);}
762 WebInspector.settings.showMetricsRulers.addChangeListener(showRulersChanged);function showRulersChanged()
763 {PageAgent.setShowViewportSizeOnResize(true,WebInspector.settings.showMetricsRulers.get());}
764 showRulersChanged();WebInspector.WorkerManager.loadCompleted();InspectorFrontendAPI.loadCompleted();if(Capabilities.canScreencast)
765 this._screencastView.initialize();WebInspector.notifications.dispatchEventToListeners(WebInspector.Events.InspectorLoaded);}
766 var windowLoaded=function()
767 {WebInspector.loaded();window.removeEventListener("DOMContentLoaded",windowLoaded,false);delete windowLoaded;};window.addEventListener("DOMContentLoaded",windowLoaded,false);var messagesToDispatch=[];WebInspector.dispatchQueueIsEmpty=function(){return messagesToDispatch.length==0;}
768 WebInspector.dispatch=function(message){messagesToDispatch.push(message);setTimeout(function(){InspectorBackend.dispatch(messagesToDispatch.shift());},0);}
769 WebInspector.windowResize=function(event)
770 {this._adjustExternalZoomFactor();if(WebInspector.inspectorView)
771 WebInspector.inspectorView.onResize();if(WebInspector.settingsController)
772 WebInspector.settingsController.resize();}
773 WebInspector.close=function(event)
774 {InspectorFrontendHost.closeWindow();}
775 WebInspector.documentClick=function(event)
776 {var anchor=event.target.enclosingNodeOrSelfWithNodeName("a");if(!anchor||(anchor.target==="_blank"))
777 return;event.consume(true);function followLink()
778 {if(WebInspector.isBeingEdited(event.target))
779 return;if(WebInspector.openAnchorLocationRegistry.dispatch({url:anchor.href,lineNumber:anchor.lineNumber}))
780 return;if(WebInspector.showAnchorLocation(anchor))
781 return;const profileMatch=WebInspector.CPUProfilerModel.ProfileURLRegExp.exec(anchor.href);if(profileMatch){WebInspector.showPanel("profiles").showProfile(profileMatch[1],profileMatch[2]);return;}
782 var parsedURL=anchor.href.asParsedURL();if(parsedURL&&parsedURL.scheme==="webkit-link-action"){if(parsedURL.host==="show-panel"){var panel=parsedURL.path.substring(1);if(WebInspector.panel(panel))
783 WebInspector.showPanel(panel);}
784 return;}
785 InspectorFrontendHost.openInNewTab(anchor.href);}
786 if(WebInspector.followLinkTimeout)
787 clearTimeout(WebInspector.followLinkTimeout);if(anchor.preventFollowOnDoubleClick){if(event.detail===1)
788 WebInspector.followLinkTimeout=setTimeout(followLink,333);return;}
789 followLink();}
790 WebInspector.openResource=function(resourceURL,inResourcesPanel)
791 {var resource=WebInspector.resourceForURL(resourceURL);if(inResourcesPanel&&resource)
792 WebInspector.showPanel("resources").showResource(resource);else
793 InspectorFrontendHost.openInNewTab(resourceURL);}
794 WebInspector._registerShortcuts=function()
795 {var shortcut=WebInspector.KeyboardShortcut;var section=WebInspector.shortcutsScreen.section(WebInspector.UIString("All Panels"));var keys=[shortcut.makeDescriptor("[",shortcut.Modifiers.CtrlOrMeta),shortcut.makeDescriptor("]",shortcut.Modifiers.CtrlOrMeta)];section.addRelatedKeys(keys,WebInspector.UIString("Go to the panel to the left/right"));keys=[shortcut.makeDescriptor("[",shortcut.Modifiers.CtrlOrMeta|shortcut.Modifiers.Alt),shortcut.makeDescriptor("]",shortcut.Modifiers.CtrlOrMeta|shortcut.Modifiers.Alt)];section.addRelatedKeys(keys,WebInspector.UIString("Go back/forward in panel history"));var toggleConsoleLabel=WebInspector.UIString("Show console");section.addKey(shortcut.makeDescriptor(shortcut.Keys.Tilde,shortcut.Modifiers.Ctrl),toggleConsoleLabel);var doNotOpenDrawerOnEsc=WebInspector.experimentsSettings.doNotOpenDrawerOnEsc.isEnabled();var toggleDrawerLabel=doNotOpenDrawerOnEsc?WebInspector.UIString("Hide drawer"):WebInspector.UIString("Toggle drawer");section.addKey(shortcut.makeDescriptor(shortcut.Keys.Esc),toggleDrawerLabel);section.addKey(shortcut.makeDescriptor("f",shortcut.Modifiers.CtrlOrMeta),WebInspector.UIString("Search"));var advancedSearchShortcut=WebInspector.AdvancedSearchController.createShortcut();section.addKey(advancedSearchShortcut,WebInspector.UIString("Search across all sources"));var inspectElementModeShortcut=WebInspector.InspectElementModeController.createShortcut();section.addKey(inspectElementModeShortcut,WebInspector.UIString("Select node to inspect"));var openResourceShortcut=WebInspector.KeyboardShortcut.makeDescriptor("o",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);section.addKey(openResourceShortcut,WebInspector.UIString("Go to source"));if(WebInspector.isMac()){keys=[shortcut.makeDescriptor("g",shortcut.Modifiers.Meta),shortcut.makeDescriptor("g",shortcut.Modifiers.Meta|shortcut.Modifiers.Shift)];section.addRelatedKeys(keys,WebInspector.UIString("Find next/previous"));}
796 var goToShortcut=WebInspector.GoToLineDialog.createShortcut();section.addKey(goToShortcut,WebInspector.UIString("Go to line"));keys=[shortcut.Keys.F1,shortcut.makeDescriptor("?")];section.addAlternateKeys(keys,WebInspector.UIString("Show general settings"));}
797 WebInspector.postDocumentKeyDown=function(event)
798 {if(event.handled)
799 return;if(WebInspector.inspectorView.currentPanel()){WebInspector.inspectorView.currentPanel().handleShortcut(event);if(event.handled){event.consume(true);return;}}
800 if(WebInspector.advancedSearchController.handleShortcut(event))
801 return;if(WebInspector.inspectElementModeController&&WebInspector.inspectElementModeController.handleShortcut(event))
802 return;switch(event.keyIdentifier){case"U+004F":case"U+0050":if(!event.shiftKey&&!event.altKey&&WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)){WebInspector.showPanel("sources").showGoToSourceDialog();event.consume(true);}
803 break;case"U+0052":if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)){WebInspector.debuggerModel.skipAllPauses(true,true);WebInspector.resourceTreeModel.reloadPage(event.shiftKey);event.consume(true);}
804 if(window.DEBUG&&event.altKey){WebInspector.reload();return;}
805 break;case"F5":if(!WebInspector.isMac()){WebInspector.resourceTreeModel.reloadPage(event.ctrlKey||event.shiftKey);event.consume(true);}
806 break;}
807 var isValidZoomShortcut=WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&!event.altKey&&!InspectorFrontendHost.isStub;switch(event.keyCode){case 107:case 187:if(isValidZoomShortcut){WebInspector._zoomIn();event.consume(true);return;}
808 break;case 109:case 189:if(isValidZoomShortcut){WebInspector._zoomOut();event.consume(true);return;}
809 break;case 48:case 96:if(isValidZoomShortcut&&!event.shiftKey){WebInspector._resetZoom();event.consume(true);return;}
810 break;}
811 if(event.keyCode===WebInspector.KeyboardShortcut.Keys.F1.code||(event.keyCode===WebInspector.KeyboardShortcut.Keys.QuestionMark.code&&event.shiftKey&&(!WebInspector.isBeingEdited(event.target)||event.metaKey))){this.settingsController.showSettingsScreen(WebInspector.SettingsScreen.Tabs.General);event.consume(true);return;}
812 var Esc="U+001B";var doNotOpenDrawerOnEsc=WebInspector.experimentsSettings.doNotOpenDrawerOnEsc.isEnabled();if(event.keyIdentifier===Esc){if(this.inspectorView.drawer().visible())
813 this.inspectorView.drawer().hide();else if(!doNotOpenDrawerOnEsc)
814 this.inspectorView.drawer().show();}
815 if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Tilde.code&&event.ctrlKey&&!event.shiftKey&&!event.altKey&&!event.metaKey)
816 this.showConsole();}
817 WebInspector.documentCanCopy=function(event)
818 {if(WebInspector.inspectorView.currentPanel()&&WebInspector.inspectorView.currentPanel().handleCopyEvent)
819 event.preventDefault();}
820 WebInspector.documentCopy=function(event)
821 {if(WebInspector.inspectorView.currentPanel()&&WebInspector.inspectorView.currentPanel().handleCopyEvent)
822 WebInspector.inspectorView.currentPanel().handleCopyEvent(event);}
823 WebInspector.contextMenuEventFired=function(event)
824 {if(event.handled||event.target.classList.contains("popup-glasspane"))
825 event.preventDefault();}
826 WebInspector.showPanel=function(panel)
827 {return WebInspector.inspectorView.showPanel(panel);}
828 WebInspector.panel=function(panel)
829 {return WebInspector.inspectorView.panel(panel);}
830 WebInspector.bringToFront=function()
831 {InspectorFrontendHost.bringToFront();}
832 WebInspector.log=function(message,messageLevel,showConsole)
833 {var self=this;function isLogAvailable()
834 {return WebInspector.ConsoleMessage&&WebInspector.RemoteObject&&self.console;}
835 function flushQueue()
836 {var queued=WebInspector.log.queued;if(!queued)
837 return;for(var i=0;i<queued.length;++i)
838 logMessage(queued[i]);delete WebInspector.log.queued;}
839 function flushQueueIfAvailable()
840 {if(!isLogAvailable())
841 return;clearInterval(WebInspector.log.interval);delete WebInspector.log.interval;flushQueue();}
842 function logMessage(message)
843 {var msg=WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.Other,messageLevel||WebInspector.ConsoleMessage.MessageLevel.Debug,message);self.console.addMessage(msg);if(showConsole)
844 WebInspector.showConsole();}
845 if(!isLogAvailable()){if(!WebInspector.log.queued)
846 WebInspector.log.queued=[];WebInspector.log.queued.push(message);if(!WebInspector.log.interval)
847 WebInspector.log.interval=setInterval(flushQueueIfAvailable,1000);return;}
848 flushQueue();logMessage(message);}
849 WebInspector.showErrorMessage=function(error)
850 {WebInspector.log(error,WebInspector.ConsoleMessage.MessageLevel.Error,true);}
851 WebInspector.inspect=function(payload,hints)
852 {var object=WebInspector.RemoteObject.fromPayload(payload);if(object.subtype==="node"){function callback(nodeId)
853 {WebInspector._updateFocusedNode(nodeId);object.release();}
854 object.pushNodeToFrontend(callback);WebInspector.showPanel("elements");return;}
855 if(object.type==="function"){function didGetDetails(error,response)
856 {object.release();if(error){console.error(error);return;}
857 var uiLocation=WebInspector.debuggerModel.rawLocationToUILocation(response.location);if(!uiLocation)
858 return;WebInspector.panel("sources").showUILocation(uiLocation,true);}
859 DebuggerAgent.getFunctionDetails(object.objectId,didGetDetails.bind(this));return;}
860 if(hints.databaseId)
861 WebInspector.showPanel("resources").selectDatabase(WebInspector.databaseModel.databaseForId(hints.databaseId));else if(hints.domStorageId)
862 WebInspector.showPanel("resources").selectDOMStorage(WebInspector.domStorageModel.storageForId(hints.domStorageId));else if(hints.copyToClipboard)
863 InspectorFrontendHost.copyText(object.value);object.release();}
864 WebInspector.detached=function(reason)
865 {WebInspector.socket._detachReason=reason;(new WebInspector.RemoteDebuggingTerminatedScreen(reason)).showModal();}
866 WebInspector.targetCrashed=function()
867 {(new WebInspector.HelpScreenUntilReload(WebInspector.UIString("Inspected target crashed"),WebInspector.UIString("Inspected target has crashed. Once it reloads we will attach to it automatically."))).showModal();}
868 WebInspector._inspectNodeRequested=function(event)
869 {WebInspector._updateFocusedNode(event.data);}
870 WebInspector._updateFocusedNode=function(nodeId)
871 {if(WebInspector.inspectElementModeController&&WebInspector.inspectElementModeController.enabled()){InspectorFrontendHost.bringToFront();WebInspector.inspectElementModeController.disable();}
872 WebInspector.showPanel("elements").revealAndSelectNode(nodeId);}
873 WebInspector.showAnchorLocation=function(anchor)
874 {var preferredPanel=this.panels[anchor.preferredPanel];if(preferredPanel&&WebInspector._showAnchorLocationInPanel(anchor,preferredPanel))
875 return true;if(WebInspector._showAnchorLocationInPanel(anchor,this.panel("sources")))
876 return true;if(WebInspector._showAnchorLocationInPanel(anchor,this.panel("resources")))
877 return true;if(WebInspector._showAnchorLocationInPanel(anchor,this.panel("network")))
878 return true;return false;}
879 WebInspector._showAnchorLocationInPanel=function(anchor,panel)
880 {if(!panel)
881 return false;var result=panel.showAnchorLocation(anchor);if(result){if(anchor.classList.contains("webkit-html-external-link")){anchor.classList.remove("webkit-html-external-link");anchor.classList.add("webkit-html-resource-link");}}
882 return result;}
883 WebInspector.evaluateInConsole=function(expression,showResultOnly)
884 {this.showConsole();this.consoleView.evaluateUsingTextPrompt(expression,showResultOnly);}
885 WebInspector.addMainEventListeners=function(doc)
886 {doc.addEventListener("keydown",this.postDocumentKeyDown.bind(this),false);doc.addEventListener("beforecopy",this.documentCanCopy.bind(this),true);doc.addEventListener("copy",this.documentCopy.bind(this),false);doc.addEventListener("contextmenu",this.contextMenuEventFired.bind(this),true);doc.addEventListener("click",this.documentClick.bind(this),true);}
887 WebInspector.Zoom={Table:[0.25,0.33,0.5,0.66,0.75,0.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4,5],DefaultOffset:6}
888 function buildPlatformExtensionAPI(extensionInfo)
889 {return"var extensionInfo = "+JSON.stringify(extensionInfo)+";"+"var tabId = "+WebInspector._inspectedTabId+";"+
890 platformExtensionAPI.toString();}
891 WebInspector.setInspectedTabId=function(tabId)
892 {WebInspector._inspectedTabId=tabId;}
893 WebInspector.getSelectionBackgroundColor=function()
894 {return InspectorFrontendHost.getSelectionBackgroundColor();}
895 WebInspector.getSelectionForegroundColor=function()
896 {return InspectorFrontendHost.getSelectionForegroundColor();}
897 window.DEBUG=true;WebInspector.ModuleManager=function()
898 {this._modules=[];this._extensions=[];}
899 WebInspector.ModuleManager.prototype={registerModule:function(json)
900 {this._modules.push(new WebInspector.ModuleManager.Module(this,(json)));},extensions:function(type)
901 {function filter(extension)
902 {return extension._type===type||extension._typeClass===type;}
903 return this._extensions.filter(filter);},instances:function(type)
904 {function instantiate(extension)
905 {return extension.instance();}
906 return this.extensions(type).filter(instantiate).map(instantiate);},orderComparator:function(type,nameProperty,orderProperty)
907 {var extensions=this.extensions(type);var orderForName={};for(var i=0;i<extensions.length;++i){var descriptor=extensions[i].descriptor();orderForName[descriptor[nameProperty]]=descriptor[orderProperty];}
908 function result(name1,name2)
909 {if(name1 in orderForName&&name2 in orderForName)
910 return orderForName[name1]-orderForName[name2];if(name1 in orderForName)
911 return-1;if(name2 in orderForName)
912 return 1;return name1.compareTo(name2);}
913 return result;}}
914 WebInspector.ModuleManager.ModuleDescriptor=function()
915 {this.name;this.extensions;this.scripts;}
916 WebInspector.ModuleManager.ExtensionDescriptor=function()
917 {this.type;this.className;this.contextTypes;}
918 WebInspector.ModuleManager.Module=function(manager,descriptor)
919 {this._manager=manager;this._descriptor=descriptor;this._name=descriptor.name;var extensions=(descriptor.extensions);for(var i=0;extensions&&i<extensions.length;++i)
920 this._manager._extensions.push(new WebInspector.ModuleManager.Extension(this,extensions[i]));this._loaded=false;}
921 WebInspector.ModuleManager.Module.prototype={name:function()
922 {return this._name;},_load:function()
923 {if(this._loaded)
924 return;if(this._isLoading){var oldStackTraceLimit=Error.stackTraceLimit;Error.stackTraceLimit=50;console.assert(false,"Module "+this._name+" is loaded from itself: "+new Error().stack);Error.stackTraceLimit=oldStackTraceLimit;return;}
925 this._isLoading=true;var scripts=this._descriptor.scripts;for(var i=0;scripts&&i<scripts.length;++i)
926 loadScript(scripts[i]);this._isLoading=false;this._loaded=true;}}
927 WebInspector.ModuleManager.Extension=function(module,descriptor)
928 {this._module=module;this._descriptor=descriptor;this._type=descriptor.type;if(this._type.startsWith("@"))
929 this._typeClass=(window.eval(this._type.substring(1)));this._className=descriptor.className||null;}
930 WebInspector.ModuleManager.Extension.prototype={descriptor:function()
931 {return this._descriptor;},module:function()
932 {return this._module;},isApplicable:function(context)
933 {var contextTypes=(this._descriptor.contextTypes);if(!contextTypes)
934 return true;for(var i=0;i<contextTypes.length;++i){var contextType=(window.eval(contextTypes[i]));if(context instanceof contextType)
935 return true;}
936 return false;},instance:function()
937 {if(!this._className)
938 return null;if(!this._instance){this._module._load();var constructorFunction=window.eval(this._className);if(!(constructorFunction instanceof Function))
939 return null;this._instance=new constructorFunction();}
940 return this._instance;}}
941 WebInspector.moduleManager=new WebInspector.ModuleManager();WebInspector.platform=function()
942 {if(!WebInspector._platform)
943 WebInspector._platform=InspectorFrontendHost.platform();return WebInspector._platform;}
944 WebInspector.isMac=function()
945 {if(typeof WebInspector._isMac==="undefined")
946 WebInspector._isMac=WebInspector.platform()==="mac";return WebInspector._isMac;}
947 WebInspector.isWin=function()
948 {if(typeof WebInspector._isWin==="undefined")
949 WebInspector._isWin=WebInspector.platform()==="windows";return WebInspector._isWin;}
950 WebInspector.PlatformFlavor={WindowsVista:"windows-vista",MacTiger:"mac-tiger",MacLeopard:"mac-leopard",MacSnowLeopard:"mac-snowleopard",MacLion:"mac-lion"}
951 WebInspector.platformFlavor=function()
952 {function detectFlavor()
953 {const userAgent=navigator.userAgent;if(WebInspector.platform()==="windows"){var match=userAgent.match(/Windows NT (\d+)\.(?:\d+)/);if(match&&match[1]>=6)
954 return WebInspector.PlatformFlavor.WindowsVista;return null;}else if(WebInspector.platform()==="mac"){var match=userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/);if(!match||match[1]!=10)
955 return WebInspector.PlatformFlavor.MacSnowLeopard;switch(Number(match[2])){case 4:return WebInspector.PlatformFlavor.MacTiger;case 5:return WebInspector.PlatformFlavor.MacLeopard;case 6:return WebInspector.PlatformFlavor.MacSnowLeopard;case 7:return WebInspector.PlatformFlavor.MacLion;case 8:case 9:default:return"";}}}
956 if(!WebInspector._platformFlavor)
957 WebInspector._platformFlavor=detectFlavor();return WebInspector._platformFlavor;}
958 WebInspector.port=function()
959 {if(!WebInspector._port)
960 WebInspector._port=InspectorFrontendHost.port();return WebInspector._port;}
961 WebInspector.Geometry={};WebInspector.Geometry._Eps=1e-5;WebInspector.Geometry.Vector=function(x,y,z)
962 {this.x=x;this.y=y;this.z=z;}
963 WebInspector.Geometry.Vector.prototype={length:function()
964 {return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);},normalize:function()
965 {var length=this.length();if(length<=WebInspector.Geometry._Eps)
966 return;this.x/=length;this.y/=length;this.z/=length;}}
967 WebInspector.Geometry.EulerAngles=function(alpha,beta,gamma)
968 {this.alpha=alpha;this.beta=beta;this.gamma=gamma;}
969 WebInspector.Geometry.EulerAngles.fromRotationMatrix=function(rotationMatrix)
970 {var beta=Math.atan2(rotationMatrix.m23,rotationMatrix.m33);var gamma=Math.atan2(-rotationMatrix.m13,Math.sqrt(rotationMatrix.m11*rotationMatrix.m11+rotationMatrix.m12*rotationMatrix.m12));var alpha=Math.atan2(rotationMatrix.m12,rotationMatrix.m11);return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radToDeg(alpha),WebInspector.Geometry.radToDeg(beta),WebInspector.Geometry.radToDeg(gamma));}
971 WebInspector.Geometry.scalarProduct=function(u,v)
972 {return u.x*v.x+u.y*v.y+u.z*v.z;}
973 WebInspector.Geometry.crossProduct=function(u,v)
974 {var x=u.y*v.z-u.z*v.y;var y=u.z*v.x-u.x*v.z;var z=u.x*v.y-u.y*v.x;return new WebInspector.Geometry.Vector(x,y,z);}
975 WebInspector.Geometry.calculateAngle=function(u,v)
976 {var uLength=u.length();var vLength=v.length();if(uLength<=WebInspector.Geometry._Eps||vLength<=WebInspector.Geometry._Eps)
977 return 0;var cos=WebInspector.Geometry.scalarProduct(u,v)/uLength/vLength;if(Math.abs(cos)>1)
978 return 0;return WebInspector.Geometry.radToDeg(Math.acos(cos));}
979 WebInspector.Geometry.radToDeg=function(rad)
980 {return rad*180/Math.PI;}
981 WebInspector.UIString=function(string,vararg)
982 {return String.vsprintf(string,Array.prototype.slice.call(arguments,1));}
983 function InspectorBackendClass()
984 {this._lastCallbackId=1;this._pendingResponsesCount=0;this._callbacks={};this._domainDispatchers={};this._eventArgs={};this._replyArgs={};this._hasErrorData={};this.dumpInspectorTimeStats=false;this.dumpInspectorProtocolMessages=false;this._initialized=false;}
985 InspectorBackendClass.prototype={nextCallbackId:function()
986 {return this._lastCallbackId++;},_wrap:function(callback,method)
987 {var callbackId=this.nextCallbackId();if(!callback)
988 callback=function(){};this._callbacks[callbackId]=callback;callback.methodName=method;if(this.dumpInspectorTimeStats)
989 callback.sendRequestTime=Date.now();return callbackId;},_getAgent:function(domain)
990 {var agentName=domain+"Agent";if(!window[agentName])
991 window[agentName]={};return window[agentName];},registerCommand:function(method,signature,replyArgs,hasErrorData)
992 {var domainAndMethod=method.split(".");var agent=this._getAgent(domainAndMethod[0]);agent[domainAndMethod[1]]=this._sendMessageToBackend.bind(this,method,signature);agent[domainAndMethod[1]]["invoke"]=this._invoke.bind(this,method,signature);this._replyArgs[method]=replyArgs;if(hasErrorData)
993 this._hasErrorData[method]=true;this._initialized=true;},registerEnum:function(type,values)
994 {var domainAndMethod=type.split(".");var agent=this._getAgent(domainAndMethod[0]);agent[domainAndMethod[1]]=values;this._initialized=true;},registerEvent:function(eventName,params)
995 {this._eventArgs[eventName]=params;this._initialized=true;},_invoke:function(method,signature,args,callback)
996 {this._wrapCallbackAndSendMessageObject(method,args,callback);},_sendMessageToBackend:function(method,signature,vararg)
997 {var args=Array.prototype.slice.call(arguments,2);var callback=(args.length&&typeof args[args.length-1]==="function")?args.pop():null;var params={};var hasParams=false;for(var i=0;i<signature.length;++i){var param=signature[i];var paramName=param["name"];var typeName=param["type"];var optionalFlag=param["optional"];if(!args.length&&!optionalFlag){console.error("Protocol Error: Invalid number of arguments for method '"+method+"' call. It must have the following arguments '"+JSON.stringify(signature)+"'.");return;}
998 var value=args.shift();if(optionalFlag&&typeof value==="undefined"){continue;}
999 if(typeof value!==typeName){console.error("Protocol Error: Invalid type of argument '"+paramName+"' for method '"+method+"' call. It must be '"+typeName+"' but it is '"+typeof value+"'.");return;}
1000 params[paramName]=value;hasParams=true;}
1001 if(args.length===1&&!callback){if(typeof args[0]!=="undefined"){console.error("Protocol Error: Optional callback argument for method '"+method+"' call must be a function but its type is '"+typeof args[0]+"'.");return;}}
1002 this._wrapCallbackAndSendMessageObject(method,hasParams?params:null,callback);},_wrapCallbackAndSendMessageObject:function(method,params,callback)
1003 {var messageObject={};messageObject.method=method;if(params)
1004 messageObject.params=params;messageObject.id=this._wrap(callback,method);if(this.dumpInspectorProtocolMessages)
1005 console.log("frontend: "+JSON.stringify(messageObject));++this._pendingResponsesCount;this.sendMessageObjectToBackend(messageObject);},sendMessageObjectToBackend:function(messageObject)
1006 {var message=JSON.stringify(messageObject);InspectorFrontendHost.sendMessageToBackend(message);},registerDomainDispatcher:function(domain,dispatcher)
1007 {this._domainDispatchers[domain]=dispatcher;},dispatch:function(message)
1008 {if(this.dumpInspectorProtocolMessages)
1009 console.log("backend: "+((typeof message==="string")?message:JSON.stringify(message)));var messageObject=(typeof message==="string")?JSON.parse(message):message;if("id"in messageObject){if(messageObject.error){if(messageObject.error.code!==-32000)
1010 this.reportProtocolError(messageObject);}
1011 var callback=this._callbacks[messageObject.id];if(callback){var argumentsArray=[null];if(messageObject.error){argumentsArray[0]=messageObject.error.message;}
1012 if(this._hasErrorData[callback.methodName]){argumentsArray.push(null);if(messageObject.error)
1013 argumentsArray[1]=messageObject.error.data;}
1014 if(messageObject.result){var paramNames=this._replyArgs[callback.methodName];if(paramNames){for(var i=0;i<paramNames.length;++i)
1015 argumentsArray.push(messageObject.result[paramNames[i]]);}}
1016 var processingStartTime;if(this.dumpInspectorTimeStats&&callback.methodName)
1017 processingStartTime=Date.now();callback.apply(null,argumentsArray);--this._pendingResponsesCount;delete this._callbacks[messageObject.id];if(this.dumpInspectorTimeStats&&callback.methodName)
1018 console.log("time-stats: "+callback.methodName+" = "+(processingStartTime-callback.sendRequestTime)+" + "+(Date.now()-processingStartTime));}
1019 if(this._scripts&&!this._pendingResponsesCount)
1020 this.runAfterPendingDispatches();return;}else{var method=messageObject.method.split(".");var domainName=method[0];var functionName=method[1];if(!(domainName in this._domainDispatchers)){console.error("Protocol Error: the message is for non-existing domain '"+domainName+"'");return;}
1021 var dispatcher=this._domainDispatchers[domainName];if(!(functionName in dispatcher)){console.error("Protocol Error: Attempted to dispatch an unimplemented method '"+messageObject.method+"'");return;}
1022 if(!this._eventArgs[messageObject.method]){console.error("Protocol Error: Attempted to dispatch an unspecified method '"+messageObject.method+"'");return;}
1023 var params=[];if(messageObject.params){var paramNames=this._eventArgs[messageObject.method];for(var i=0;i<paramNames.length;++i)
1024 params.push(messageObject.params[paramNames[i]]);}
1025 var processingStartTime;if(this.dumpInspectorTimeStats)
1026 processingStartTime=Date.now();dispatcher[functionName].apply(dispatcher,params);if(this.dumpInspectorTimeStats)
1027 console.log("time-stats: "+messageObject.method+" = "+(Date.now()-processingStartTime));}},reportProtocolError:function(messageObject)
1028 {console.error("Request with id = "+messageObject.id+" failed. "+JSON.stringify(messageObject.error));},runAfterPendingDispatches:function(script)
1029 {if(!this._scripts)
1030 this._scripts=[];if(script)
1031 this._scripts.push(script);if(!this._pendingResponsesCount){var scripts=this._scripts;this._scripts=[]
1032 for(var id=0;id<scripts.length;++id)
1033 scripts[id].call(this);}},loadFromJSONIfNeeded:function(jsonUrl)
1034 {if(this._initialized)
1035 return;var xhr=new XMLHttpRequest();xhr.open("GET",jsonUrl,false);xhr.send(null);var schema=JSON.parse(xhr.responseText);var code=InspectorBackendClass._generateCommands(schema);eval(code);},wrapClientCallback:function(clientCallback,errorPrefix,constructor,defaultValue)
1036 {function callbackWrapper(error,value)
1037 {if(error){console.error(errorPrefix+error);clientCallback(defaultValue);return;}
1038 if(constructor)
1039 clientCallback(new constructor(value));else
1040 clientCallback(value);}
1041 return callbackWrapper;}}
1042 InspectorBackendClass._generateCommands=function(schema){var jsTypes={integer:"number",array:"object"};var rawTypes={};var result=[];var domains=schema["domains"]||[];for(var i=0;i<domains.length;++i){var domain=domains[i];for(var j=0;domain.types&&j<domain.types.length;++j){var type=domain.types[j];rawTypes[domain.domain+"."+type.id]=jsTypes[type.type]||type.type;}}
1043 function toUpperCase(groupIndex,group0,group1)
1044 {return[group0,group1][groupIndex].toUpperCase();}
1045 function generateEnum(enumName,items)
1046 {var members=[]
1047 for(var m=0;m<items.length;++m){var value=items[m];var name=value.replace(/-(\w)/g,toUpperCase.bind(null,1)).toTitleCase();name=name.replace(/HTML|XML|WML|API/ig,toUpperCase.bind(null,0));members.push(name+": \""+value+"\"");}
1048 return"InspectorBackend.registerEnum(\""+enumName+"\", {"+members.join(", ")+"});";}
1049 for(var i=0;i<domains.length;++i){var domain=domains[i];var types=domain["types"]||[];for(var j=0;j<types.length;++j){var type=types[j];if((type["type"]==="string")&&type["enum"])
1050 result.push(generateEnum(domain.domain+"."+type.id,type["enum"]));else if(type["type"]==="object"){var properties=type["properties"]||[];for(var k=0;k<properties.length;++k){var property=properties[k];if((property["type"]==="string")&&property["enum"])
1051 result.push(generateEnum(domain.domain+"."+type.id+property["name"].toTitleCase(),property["enum"]));}}}
1052 var commands=domain["commands"]||[];for(var j=0;j<commands.length;++j){var command=commands[j];var parameters=command["parameters"];var paramsText=[];for(var k=0;parameters&&k<parameters.length;++k){var parameter=parameters[k];var type;if(parameter.type)
1053 type=jsTypes[parameter.type]||parameter.type;else{var ref=parameter["$ref"];if(ref.indexOf(".")!==-1)
1054 type=rawTypes[ref];else
1055 type=rawTypes[domain.domain+"."+ref];}
1056 var text="{\"name\": \""+parameter.name+"\", \"type\": \""+type+"\", \"optional\": "+(parameter.optional?"true":"false")+"}";paramsText.push(text);}
1057 var returnsText=[];var returns=command["returns"]||[];for(var k=0;k<returns.length;++k){var parameter=returns[k];returnsText.push("\""+parameter.name+"\"");}
1058 var hasErrorData=String(Boolean(command.error));result.push("InspectorBackend.registerCommand(\""+domain.domain+"."+command.name+"\", ["+paramsText.join(", ")+"], ["+returnsText.join(", ")+"], "+hasErrorData+");");}
1059 for(var j=0;domain.events&&j<domain.events.length;++j){var event=domain.events[j];var paramsText=[];for(var k=0;event.parameters&&k<event.parameters.length;++k){var parameter=event.parameters[k];paramsText.push("\""+parameter.name+"\"");}
1060 result.push("InspectorBackend.registerEvent(\""+domain.domain+"."+event.name+"\", ["+paramsText.join(", ")+"]);");}
1061 result.push("InspectorBackend.register"+domain.domain+"Dispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, \""+domain.domain+"\");");}
1062 return result.join("\n");}
1063 InspectorBackend=new InspectorBackendClass();InspectorBackend.registerInspectorDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Inspector");InspectorBackend.registerEvent("Inspector.evaluateForTestInFrontend",["testCallId","script"]);InspectorBackend.registerEvent("Inspector.inspect",["object","hints"]);InspectorBackend.registerEvent("Inspector.detached",["reason"]);InspectorBackend.registerEvent("Inspector.targetCrashed",[]);InspectorBackend.registerCommand("Inspector.enable",[],[],false);InspectorBackend.registerCommand("Inspector.disable",[],[],false);InspectorBackend.registerCommand("Inspector.reset",[],[],false);InspectorBackend.registerMemoryDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Memory");InspectorBackend.registerCommand("Memory.getDOMCounters",[],["documents","nodes","jsEventListeners"],false);InspectorBackend.registerPageDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Page");InspectorBackend.registerEnum("Page.ResourceType",{Document:"Document",Stylesheet:"Stylesheet",Image:"Image",Font:"Font",Script:"Script",XHR:"XHR",WebSocket:"WebSocket",Other:"Other"});InspectorBackend.registerEnum("Page.UsageItemId",{Filesystem:"filesystem",Database:"database",Appcache:"appcache",Indexeddatabase:"indexeddatabase"});InspectorBackend.registerEvent("Page.domContentEventFired",["timestamp"]);InspectorBackend.registerEvent("Page.loadEventFired",["timestamp"]);InspectorBackend.registerEvent("Page.frameAttached",["frameId","parentFrameId"]);InspectorBackend.registerEvent("Page.frameNavigated",["frame"]);InspectorBackend.registerEvent("Page.frameDetached",["frameId"]);InspectorBackend.registerEvent("Page.frameStartedLoading",["frameId"]);InspectorBackend.registerEvent("Page.frameStoppedLoading",["frameId"]);InspectorBackend.registerEvent("Page.frameScheduledNavigation",["frameId","delay"]);InspectorBackend.registerEvent("Page.frameClearedScheduledNavigation",["frameId"]);InspectorBackend.registerEvent("Page.frameResized",[]);InspectorBackend.registerEvent("Page.javascriptDialogOpening",["message"]);InspectorBackend.registerEvent("Page.javascriptDialogClosed",[]);InspectorBackend.registerEvent("Page.scriptsEnabled",["isEnabled"]);InspectorBackend.registerEvent("Page.screencastFrame",["data","metadata"]);InspectorBackend.registerEvent("Page.screencastVisibilityChanged",["visible"]);InspectorBackend.registerCommand("Page.enable",[],[],false);InspectorBackend.registerCommand("Page.disable",[],[],false);InspectorBackend.registerCommand("Page.addScriptToEvaluateOnLoad",[{"name":"scriptSource","type":"string","optional":false}],["identifier"],false);InspectorBackend.registerCommand("Page.removeScriptToEvaluateOnLoad",[{"name":"identifier","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.reload",[{"name":"ignoreCache","type":"boolean","optional":true},{"name":"scriptToEvaluateOnLoad","type":"string","optional":true},{"name":"scriptPreprocessor","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Page.navigate",[{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.getNavigationHistory",[],["currentIndex","entries"],false);InspectorBackend.registerCommand("Page.navigateToHistoryEntry",[{"name":"entryId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.getCookies",[],["cookies"],false);InspectorBackend.registerCommand("Page.deleteCookie",[{"name":"cookieName","type":"string","optional":false},{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.getResourceTree",[],["frameTree"],false);InspectorBackend.registerCommand("Page.getResourceContent",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false}],["content","base64Encoded"],false);InspectorBackend.registerCommand("Page.searchInResource",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false},{"name":"query","type":"string","optional":false},{"name":"caseSensitive","type":"boolean","optional":true},{"name":"isRegex","type":"boolean","optional":true}],["result"],false);InspectorBackend.registerCommand("Page.setDocumentContent",[{"name":"frameId","type":"string","optional":false},{"name":"html","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.setDeviceMetricsOverride",[{"name":"width","type":"number","optional":false},{"name":"height","type":"number","optional":false},{"name":"deviceScaleFactor","type":"number","optional":false},{"name":"emulateViewport","type":"boolean","optional":false},{"name":"fitWindow","type":"boolean","optional":false},{"name":"textAutosizing","type":"boolean","optional":true},{"name":"fontScaleFactor","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.setShowPaintRects",[{"name":"result","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowDebugBorders",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowFPSCounter",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setContinuousPaintingEnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowScrollBottleneckRects",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.getScriptExecutionStatus",[],["result"],false);InspectorBackend.registerCommand("Page.setScriptExecutionDisabled",[{"name":"value","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setGeolocationOverride",[{"name":"latitude","type":"number","optional":true},{"name":"longitude","type":"number","optional":true},{"name":"accuracy","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.clearGeolocationOverride",[],[],false);InspectorBackend.registerCommand("Page.setDeviceOrientationOverride",[{"name":"alpha","type":"number","optional":false},{"name":"beta","type":"number","optional":false},{"name":"gamma","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.clearDeviceOrientationOverride",[],[],false);InspectorBackend.registerCommand("Page.setTouchEmulationEnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setEmulatedMedia",[{"name":"media","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.captureScreenshot",[{"name":"format","type":"string","optional":true},{"name":"quality","type":"number","optional":true},{"name":"maxWidth","type":"number","optional":true},{"name":"maxHeight","type":"number","optional":true}],["data","metadata"],false);InspectorBackend.registerCommand("Page.canScreencast",[],["result"],false);InspectorBackend.registerCommand("Page.startScreencast",[{"name":"format","type":"string","optional":true},{"name":"quality","type":"number","optional":true},{"name":"maxWidth","type":"number","optional":true},{"name":"maxHeight","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.stopScreencast",[],[],false);InspectorBackend.registerCommand("Page.handleJavaScriptDialog",[{"name":"accept","type":"boolean","optional":false},{"name":"promptText","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Page.setShowViewportSizeOnResize",[{"name":"show","type":"boolean","optional":false},{"name":"showGrid","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Page.queryUsageAndQuota",[{"name":"securityOrigin","type":"string","optional":false}],["quota","usage"],false);InspectorBackend.registerRuntimeDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Runtime");InspectorBackend.registerEnum("Runtime.RemoteObjectType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean"});InspectorBackend.registerEnum("Runtime.RemoteObjectSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date"});InspectorBackend.registerEnum("Runtime.PropertyPreviewType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean",Accessor:"accessor"});InspectorBackend.registerEnum("Runtime.PropertyPreviewSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date"});InspectorBackend.registerEvent("Runtime.executionContextCreated",["context"]);InspectorBackend.registerCommand("Runtime.evaluate",[{"name":"expression","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true},{"name":"includeCommandLineAPI","type":"boolean","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"contextId","type":"number","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Runtime.callFunctionOn",[{"name":"objectId","type":"string","optional":false},{"name":"functionDeclaration","type":"string","optional":false},{"name":"arguments","type":"object","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Runtime.getProperties",[{"name":"objectId","type":"string","optional":false},{"name":"ownProperties","type":"boolean","optional":true},{"name":"accessorPropertiesOnly","type":"boolean","optional":true}],["result","internalProperties"],false);InspectorBackend.registerCommand("Runtime.releaseObject",[{"name":"objectId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Runtime.releaseObjectGroup",[{"name":"objectGroup","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Runtime.run",[],[],false);InspectorBackend.registerCommand("Runtime.enable",[],[],false);InspectorBackend.registerCommand("Runtime.disable",[],[],false);InspectorBackend.registerConsoleDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Console");InspectorBackend.registerEnum("Console.ConsoleMessageSource",{XML:"xml",Javascript:"javascript",Network:"network",ConsoleAPI:"console-api",Storage:"storage",Appcache:"appcache",Rendering:"rendering",Css:"css",Security:"security",Other:"other",Deprecation:"deprecation"});InspectorBackend.registerEnum("Console.ConsoleMessageLevel",{Log:"log",Warning:"warning",Error:"error",Debug:"debug",Info:"info"});InspectorBackend.registerEnum("Console.ConsoleMessageType",{Log:"log",Dir:"dir",DirXML:"dirxml",Table:"table",Trace:"trace",Clear:"clear",StartGroup:"startGroup",StartGroupCollapsed:"startGroupCollapsed",EndGroup:"endGroup",Assert:"assert",Profile:"profile",ProfileEnd:"profileEnd"});InspectorBackend.registerEvent("Console.messageAdded",["message"]);InspectorBackend.registerEvent("Console.messageRepeatCountUpdated",["count","timestamp"]);InspectorBackend.registerEvent("Console.messagesCleared",[]);InspectorBackend.registerCommand("Console.enable",[],[],false);InspectorBackend.registerCommand("Console.disable",[],[],false);InspectorBackend.registerCommand("Console.clearMessages",[],[],false);InspectorBackend.registerCommand("Console.setMonitoringXHREnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Console.addInspectedNode",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Console.addInspectedHeapObject",[{"name":"heapObjectId","type":"number","optional":false}],[],false);InspectorBackend.registerNetworkDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Network");InspectorBackend.registerEnum("Network.InitiatorType",{Parser:"parser",Script:"script",Other:"other"});InspectorBackend.registerEvent("Network.requestWillBeSent",["requestId","frameId","loaderId","documentURL","request","timestamp","initiator","redirectResponse"]);InspectorBackend.registerEvent("Network.requestServedFromCache",["requestId"]);InspectorBackend.registerEvent("Network.responseReceived",["requestId","frameId","loaderId","timestamp","type","response"]);InspectorBackend.registerEvent("Network.dataReceived",["requestId","timestamp","dataLength","encodedDataLength"]);InspectorBackend.registerEvent("Network.loadingFinished",["requestId","timestamp"]);InspectorBackend.registerEvent("Network.loadingFailed",["requestId","timestamp","errorText","canceled"]);InspectorBackend.registerEvent("Network.webSocketWillSendHandshakeRequest",["requestId","timestamp","request"]);InspectorBackend.registerEvent("Network.webSocketHandshakeResponseReceived",["requestId","timestamp","response"]);InspectorBackend.registerEvent("Network.webSocketCreated",["requestId","url"]);InspectorBackend.registerEvent("Network.webSocketClosed",["requestId","timestamp"]);InspectorBackend.registerEvent("Network.webSocketFrameReceived",["requestId","timestamp","response"]);InspectorBackend.registerEvent("Network.webSocketFrameError",["requestId","timestamp","errorMessage"]);InspectorBackend.registerEvent("Network.webSocketFrameSent",["requestId","timestamp","response"]);InspectorBackend.registerCommand("Network.enable",[],[],false);InspectorBackend.registerCommand("Network.disable",[],[],false);InspectorBackend.registerCommand("Network.setUserAgentOverride",[{"name":"userAgent","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Network.setExtraHTTPHeaders",[{"name":"headers","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("Network.getResponseBody",[{"name":"requestId","type":"string","optional":false}],["body","base64Encoded"],false);InspectorBackend.registerCommand("Network.replayXHR",[{"name":"requestId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Network.canClearBrowserCache",[],["result"],false);InspectorBackend.registerCommand("Network.clearBrowserCache",[],[],false);InspectorBackend.registerCommand("Network.canClearBrowserCookies",[],["result"],false);InspectorBackend.registerCommand("Network.clearBrowserCookies",[],[],false);InspectorBackend.registerCommand("Network.setCacheDisabled",[{"name":"cacheDisabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Network.loadResourceForFrontend",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false},{"name":"requestHeaders","type":"object","optional":true}],["statusCode","responseHeaders","content"],false);InspectorBackend.registerDatabaseDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Database");InspectorBackend.registerEvent("Database.addDatabase",["database"]);InspectorBackend.registerCommand("Database.enable",[],[],false);InspectorBackend.registerCommand("Database.disable",[],[],false);InspectorBackend.registerCommand("Database.getDatabaseTableNames",[{"name":"databaseId","type":"string","optional":false}],["tableNames"],false);InspectorBackend.registerCommand("Database.executeSQL",[{"name":"databaseId","type":"string","optional":false},{"name":"query","type":"string","optional":false}],["columnNames","values","sqlError"],false);InspectorBackend.registerIndexedDBDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"IndexedDB");InspectorBackend.registerEnum("IndexedDB.KeyType",{Number:"number",String:"string",Date:"date",Array:"array"});InspectorBackend.registerEnum("IndexedDB.KeyPathType",{Null:"null",String:"string",Array:"array"});InspectorBackend.registerCommand("IndexedDB.enable",[],[],false);InspectorBackend.registerCommand("IndexedDB.disable",[],[],false);InspectorBackend.registerCommand("IndexedDB.requestDatabaseNames",[{"name":"securityOrigin","type":"string","optional":false}],["databaseNames"],false);InspectorBackend.registerCommand("IndexedDB.requestDatabase",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false}],["databaseWithObjectStores"],false);InspectorBackend.registerCommand("IndexedDB.requestData",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false},{"name":"objectStoreName","type":"string","optional":false},{"name":"indexName","type":"string","optional":false},{"name":"skipCount","type":"number","optional":false},{"name":"pageSize","type":"number","optional":false},{"name":"keyRange","type":"object","optional":true}],["objectStoreDataEntries","hasMore"],false);InspectorBackend.registerCommand("IndexedDB.clearObjectStore",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false},{"name":"objectStoreName","type":"string","optional":false}],[],false);InspectorBackend.registerDOMStorageDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"DOMStorage");InspectorBackend.registerEvent("DOMStorage.domStorageItemsCleared",["storageId"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemRemoved",["storageId","key"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemAdded",["storageId","key","newValue"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemUpdated",["storageId","key","oldValue","newValue"]);InspectorBackend.registerCommand("DOMStorage.enable",[],[],false);InspectorBackend.registerCommand("DOMStorage.disable",[],[],false);InspectorBackend.registerCommand("DOMStorage.getDOMStorageItems",[{"name":"storageId","type":"object","optional":false}],["entries"],false);InspectorBackend.registerCommand("DOMStorage.setDOMStorageItem",[{"name":"storageId","type":"object","optional":false},{"name":"key","type":"string","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMStorage.removeDOMStorageItem",[{"name":"storageId","type":"object","optional":false},{"name":"key","type":"string","optional":false}],[],false);InspectorBackend.registerApplicationCacheDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"ApplicationCache");InspectorBackend.registerEvent("ApplicationCache.applicationCacheStatusUpdated",["frameId","manifestURL","status"]);InspectorBackend.registerEvent("ApplicationCache.networkStateUpdated",["isNowOnline"]);InspectorBackend.registerCommand("ApplicationCache.getFramesWithManifests",[],["frameIds"],false);InspectorBackend.registerCommand("ApplicationCache.enable",[],[],false);InspectorBackend.registerCommand("ApplicationCache.getManifestForFrame",[{"name":"frameId","type":"string","optional":false}],["manifestURL"],false);InspectorBackend.registerCommand("ApplicationCache.getApplicationCacheForFrame",[{"name":"frameId","type":"string","optional":false}],["applicationCache"],false);InspectorBackend.registerFileSystemDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"FileSystem");InspectorBackend.registerCommand("FileSystem.enable",[],[],false);InspectorBackend.registerCommand("FileSystem.disable",[],[],false);InspectorBackend.registerCommand("FileSystem.requestFileSystemRoot",[{"name":"origin","type":"string","optional":false},{"name":"type","type":"string","optional":false}],["errorCode","root"],false);InspectorBackend.registerCommand("FileSystem.requestDirectoryContent",[{"name":"url","type":"string","optional":false}],["errorCode","entries"],false);InspectorBackend.registerCommand("FileSystem.requestMetadata",[{"name":"url","type":"string","optional":false}],["errorCode","metadata"],false);InspectorBackend.registerCommand("FileSystem.requestFileContent",[{"name":"url","type":"string","optional":false},{"name":"readAsText","type":"boolean","optional":false},{"name":"start","type":"number","optional":true},{"name":"end","type":"number","optional":true},{"name":"charset","type":"string","optional":true}],["errorCode","content","charset"],false);InspectorBackend.registerCommand("FileSystem.deleteEntry",[{"name":"url","type":"string","optional":false}],["errorCode"],false);InspectorBackend.registerDOMDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"DOM");InspectorBackend.registerEnum("DOM.PseudoType",{Before:"before",After:"after"});InspectorBackend.registerEnum("DOM.ShadowRootType",{UserAgent:"user-agent",Author:"author"});InspectorBackend.registerEvent("DOM.documentUpdated",[]);InspectorBackend.registerEvent("DOM.inspectNodeRequested",["nodeId"]);InspectorBackend.registerEvent("DOM.setChildNodes",["parentId","nodes"]);InspectorBackend.registerEvent("DOM.attributeModified",["nodeId","name","value"]);InspectorBackend.registerEvent("DOM.attributeRemoved",["nodeId","name"]);InspectorBackend.registerEvent("DOM.inlineStyleInvalidated",["nodeIds"]);InspectorBackend.registerEvent("DOM.characterDataModified",["nodeId","characterData"]);InspectorBackend.registerEvent("DOM.childNodeCountUpdated",["nodeId","childNodeCount"]);InspectorBackend.registerEvent("DOM.childNodeInserted",["parentNodeId","previousNodeId","node"]);InspectorBackend.registerEvent("DOM.childNodeRemoved",["parentNodeId","nodeId"]);InspectorBackend.registerEvent("DOM.shadowRootPushed",["hostId","root"]);InspectorBackend.registerEvent("DOM.shadowRootPopped",["hostId","rootId"]);InspectorBackend.registerEvent("DOM.pseudoElementAdded",["parentId","pseudoElement"]);InspectorBackend.registerEvent("DOM.pseudoElementRemoved",["parentId","pseudoElementId"]);InspectorBackend.registerCommand("DOM.getDocument",[],["root"],false);InspectorBackend.registerCommand("DOM.requestChildNodes",[{"name":"nodeId","type":"number","optional":false},{"name":"depth","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("DOM.querySelector",[{"name":"nodeId","type":"number","optional":false},{"name":"selector","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.querySelectorAll",[{"name":"nodeId","type":"number","optional":false},{"name":"selector","type":"string","optional":false}],["nodeIds"],false);InspectorBackend.registerCommand("DOM.setNodeName",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.setNodeValue",[{"name":"nodeId","type":"number","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.removeNode",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setAttributeValue",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setAttributesAsText",[{"name":"nodeId","type":"number","optional":false},{"name":"text","type":"string","optional":false},{"name":"name","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("DOM.removeAttribute",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.getEventListenersForNode",[{"name":"nodeId","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["listeners"],false);InspectorBackend.registerCommand("DOM.getOuterHTML",[{"name":"nodeId","type":"number","optional":false}],["outerHTML"],false);InspectorBackend.registerCommand("DOM.setOuterHTML",[{"name":"nodeId","type":"number","optional":false},{"name":"outerHTML","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.performSearch",[{"name":"query","type":"string","optional":false}],["searchId","resultCount"],false);InspectorBackend.registerCommand("DOM.getSearchResults",[{"name":"searchId","type":"string","optional":false},{"name":"fromIndex","type":"number","optional":false},{"name":"toIndex","type":"number","optional":false}],["nodeIds"],false);InspectorBackend.registerCommand("DOM.discardSearchResults",[{"name":"searchId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.requestNode",[{"name":"objectId","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.setInspectModeEnabled",[{"name":"enabled","type":"boolean","optional":false},{"name":"inspectShadowDOM","type":"boolean","optional":true},{"name":"highlightConfig","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightRect",[{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"width","type":"number","optional":false},{"name":"height","type":"number","optional":false},{"name":"color","type":"object","optional":true},{"name":"outlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightQuad",[{"name":"quad","type":"object","optional":false},{"name":"color","type":"object","optional":true},{"name":"outlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightNode",[{"name":"highlightConfig","type":"object","optional":false},{"name":"nodeId","type":"number","optional":true},{"name":"objectId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("DOM.hideHighlight",[],[],false);InspectorBackend.registerCommand("DOM.highlightFrame",[{"name":"frameId","type":"string","optional":false},{"name":"contentColor","type":"object","optional":true},{"name":"contentOutlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.pushNodeByPathToFrontend",[{"name":"path","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.pushNodeByBackendIdToFrontend",[{"name":"backendNodeId","type":"number","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.releaseBackendNodeIds",[{"name":"nodeGroup","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.resolveNode",[{"name":"nodeId","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["object"],false);InspectorBackend.registerCommand("DOM.getAttributes",[{"name":"nodeId","type":"number","optional":false}],["attributes"],false);InspectorBackend.registerCommand("DOM.moveTo",[{"name":"nodeId","type":"number","optional":false},{"name":"targetNodeId","type":"number","optional":false},{"name":"insertBeforeNodeId","type":"number","optional":true}],["nodeId"],false);InspectorBackend.registerCommand("DOM.undo",[],[],false);InspectorBackend.registerCommand("DOM.redo",[],[],false);InspectorBackend.registerCommand("DOM.markUndoableState",[],[],false);InspectorBackend.registerCommand("DOM.focus",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setFileInputFiles",[{"name":"nodeId","type":"number","optional":false},{"name":"files","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("DOM.getBoxModel",[{"name":"nodeId","type":"number","optional":false}],["model"],false);InspectorBackend.registerCommand("DOM.getNodeForLocation",[{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.getRelayoutBoundary",[{"name":"nodeId","type":"number","optional":false}],["nodeId"],false);InspectorBackend.registerCSSDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"CSS");InspectorBackend.registerEnum("CSS.StyleSheetOrigin",{User:"user",UserAgent:"user-agent",Inspector:"inspector",Regular:"regular"});InspectorBackend.registerEnum("CSS.CSSPropertyStatus",{Active:"active",Inactive:"inactive",Disabled:"disabled",Style:"style"});InspectorBackend.registerEnum("CSS.CSSMediaSource",{MediaRule:"mediaRule",ImportRule:"importRule",LinkedSheet:"linkedSheet",InlineSheet:"inlineSheet"});InspectorBackend.registerEnum("CSS.RegionRegionOverset",{Overset:"overset",Fit:"fit",Empty:"empty"});InspectorBackend.registerEvent("CSS.mediaQueryResultChanged",[]);InspectorBackend.registerEvent("CSS.styleSheetChanged",["styleSheetId"]);InspectorBackend.registerEvent("CSS.styleSheetAdded",["header"]);InspectorBackend.registerEvent("CSS.styleSheetRemoved",["styleSheetId"]);InspectorBackend.registerEvent("CSS.namedFlowCreated",["namedFlow"]);InspectorBackend.registerEvent("CSS.namedFlowRemoved",["documentNodeId","flowName"]);InspectorBackend.registerEvent("CSS.regionLayoutUpdated",["namedFlow"]);InspectorBackend.registerEvent("CSS.regionOversetChanged",["namedFlow"]);InspectorBackend.registerCommand("CSS.enable",[],[],false);InspectorBackend.registerCommand("CSS.disable",[],[],false);InspectorBackend.registerCommand("CSS.getMatchedStylesForNode",[{"name":"nodeId","type":"number","optional":false},{"name":"includePseudo","type":"boolean","optional":true},{"name":"includeInherited","type":"boolean","optional":true}],["matchedCSSRules","pseudoElements","inherited"],false);InspectorBackend.registerCommand("CSS.getInlineStylesForNode",[{"name":"nodeId","type":"number","optional":false}],["inlineStyle","attributesStyle"],false);InspectorBackend.registerCommand("CSS.getComputedStyleForNode",[{"name":"nodeId","type":"number","optional":false}],["computedStyle"],false);InspectorBackend.registerCommand("CSS.getPlatformFontsForNode",[{"name":"nodeId","type":"number","optional":false}],["cssFamilyName","fonts"],false);InspectorBackend.registerCommand("CSS.getAllStyleSheets",[],["headers"],false);InspectorBackend.registerCommand("CSS.getStyleSheet",[{"name":"styleSheetId","type":"string","optional":false}],["styleSheet"],false);InspectorBackend.registerCommand("CSS.getStyleSheetText",[{"name":"styleSheetId","type":"string","optional":false}],["text"],false);InspectorBackend.registerCommand("CSS.setStyleSheetText",[{"name":"styleSheetId","type":"string","optional":false},{"name":"text","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("CSS.setStyleText",[{"name":"styleId","type":"object","optional":false},{"name":"text","type":"string","optional":false}],["style"],false);InspectorBackend.registerCommand("CSS.setPropertyText",[{"name":"styleId","type":"object","optional":false},{"name":"propertyIndex","type":"number","optional":false},{"name":"text","type":"string","optional":false},{"name":"overwrite","type":"boolean","optional":false}],["style"],false);InspectorBackend.registerCommand("CSS.toggleProperty",[{"name":"styleId","type":"object","optional":false},{"name":"propertyIndex","type":"number","optional":false},{"name":"disable","type":"boolean","optional":false}],["style"],false);InspectorBackend.registerCommand("CSS.setRuleSelector",[{"name":"ruleId","type":"object","optional":false},{"name":"selector","type":"string","optional":false}],["rule"],false);InspectorBackend.registerCommand("CSS.addRule",[{"name":"contextNodeId","type":"number","optional":false},{"name":"selector","type":"string","optional":false}],["rule"],false);InspectorBackend.registerCommand("CSS.getSupportedCSSProperties",[],["cssProperties"],false);InspectorBackend.registerCommand("CSS.forcePseudoState",[{"name":"nodeId","type":"number","optional":false},{"name":"forcedPseudoClasses","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("CSS.getNamedFlowCollection",[{"name":"documentNodeId","type":"number","optional":false}],["namedFlows"],false);InspectorBackend.registerTimelineDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Timeline");InspectorBackend.registerEvent("Timeline.eventRecorded",["record"]);InspectorBackend.registerEvent("Timeline.started",["consoleTimeline"]);InspectorBackend.registerEvent("Timeline.stopped",["consoleTimeline"]);InspectorBackend.registerCommand("Timeline.enable",[],[],false);InspectorBackend.registerCommand("Timeline.disable",[],[],false);InspectorBackend.registerCommand("Timeline.start",[{"name":"maxCallStackDepth","type":"number","optional":true},{"name":"bufferEvents","type":"boolean","optional":true},{"name":"includeCounters","type":"boolean","optional":true},{"name":"includeGPUEvents","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Timeline.stop",[],["events"],false);InspectorBackend.registerDebuggerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Debugger");InspectorBackend.registerEnum("Debugger.ScopeType",{Global:"global",Local:"local",With:"with",Closure:"closure",Catch:"catch"});InspectorBackend.registerEvent("Debugger.globalObjectCleared",[]);InspectorBackend.registerEvent("Debugger.scriptParsed",["scriptId","url","startLine","startColumn","endLine","endColumn","isContentScript","sourceMapURL","hasSourceURL"]);InspectorBackend.registerEvent("Debugger.scriptFailedToParse",["url","scriptSource","startLine","errorLine","errorMessage"]);InspectorBackend.registerEvent("Debugger.breakpointResolved",["breakpointId","location"]);InspectorBackend.registerEvent("Debugger.paused",["callFrames","reason","data","hitBreakpoints","asyncStackTrace"]);InspectorBackend.registerEvent("Debugger.resumed",[]);InspectorBackend.registerCommand("Debugger.enable",[],[],false);InspectorBackend.registerCommand("Debugger.disable",[],[],false);InspectorBackend.registerCommand("Debugger.setBreakpointsActive",[{"name":"active","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.setSkipAllPauses",[{"name":"skipped","type":"boolean","optional":false},{"name":"untilReload","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.setBreakpointByUrl",[{"name":"lineNumber","type":"number","optional":false},{"name":"url","type":"string","optional":true},{"name":"urlRegex","type":"string","optional":true},{"name":"columnNumber","type":"number","optional":true},{"name":"condition","type":"string","optional":true},{"name":"isAntibreakpoint","type":"boolean","optional":true}],["breakpointId","locations"],false);InspectorBackend.registerCommand("Debugger.setBreakpoint",[{"name":"location","type":"object","optional":false},{"name":"condition","type":"string","optional":true}],["breakpointId","actualLocation"],false);InspectorBackend.registerCommand("Debugger.removeBreakpoint",[{"name":"breakpointId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.continueToLocation",[{"name":"location","type":"object","optional":false},{"name":"interstatementLocation","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.stepOver",[{"name":"callFrameId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.stepInto",[],[],false);InspectorBackend.registerCommand("Debugger.stepOut",[{"name":"callFrameId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.pause",[],[],false);InspectorBackend.registerCommand("Debugger.resume",[],[],false);InspectorBackend.registerCommand("Debugger.searchInContent",[{"name":"scriptId","type":"string","optional":false},{"name":"query","type":"string","optional":false},{"name":"caseSensitive","type":"boolean","optional":true},{"name":"isRegex","type":"boolean","optional":true}],["result"],false);InspectorBackend.registerCommand("Debugger.canSetScriptSource",[],["result"],false);InspectorBackend.registerCommand("Debugger.setScriptSource",[{"name":"scriptId","type":"string","optional":false},{"name":"scriptSource","type":"string","optional":false},{"name":"preview","type":"boolean","optional":true}],["callFrames","result","asyncStackTrace"],true);InspectorBackend.registerCommand("Debugger.restartFrame",[{"name":"callFrameId","type":"string","optional":false}],["callFrames","result","asyncStackTrace"],false);InspectorBackend.registerCommand("Debugger.getScriptSource",[{"name":"scriptId","type":"string","optional":false}],["scriptSource"],false);InspectorBackend.registerCommand("Debugger.getFunctionDetails",[{"name":"functionId","type":"string","optional":false}],["details"],false);InspectorBackend.registerCommand("Debugger.setPauseOnExceptions",[{"name":"state","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.evaluateOnCallFrame",[{"name":"callFrameId","type":"string","optional":false},{"name":"expression","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true},{"name":"includeCommandLineAPI","type":"boolean","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Debugger.compileScript",[{"name":"expression","type":"string","optional":false},{"name":"sourceURL","type":"string","optional":false}],["scriptId","syntaxErrorMessage"],false);InspectorBackend.registerCommand("Debugger.runScript",[{"name":"scriptId","type":"string","optional":false},{"name":"contextId","type":"number","optional":true},{"name":"objectGroup","type":"string","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Debugger.setOverlayMessage",[{"name":"message","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.setVariableValue",[{"name":"scopeNumber","type":"number","optional":false},{"name":"variableName","type":"string","optional":false},{"name":"newValue","type":"object","optional":false},{"name":"callFrameId","type":"string","optional":true},{"name":"functionObjectId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.getStepInPositions",[{"name":"callFrameId","type":"string","optional":false}],["stepInPositions"],false);InspectorBackend.registerCommand("Debugger.getBacktrace",[],["callFrames","asyncStackTrace"],false);InspectorBackend.registerCommand("Debugger.skipStackFrames",[{"name":"script","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.setAsyncCallStackDepth",[{"name":"maxDepth","type":"number","optional":false}],[],false);InspectorBackend.registerDOMDebuggerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"DOMDebugger");InspectorBackend.registerEnum("DOMDebugger.DOMBreakpointType",{SubtreeModified:"subtree-modified",AttributeModified:"attribute-modified",NodeRemoved:"node-removed"});InspectorBackend.registerCommand("DOMDebugger.setDOMBreakpoint",[{"name":"nodeId","type":"number","optional":false},{"name":"type","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeDOMBreakpoint",[{"name":"nodeId","type":"number","optional":false},{"name":"type","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.setEventListenerBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeEventListenerBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.setInstrumentationBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeInstrumentationBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.setXHRBreakpoint",[{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeXHRBreakpoint",[{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerProfilerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Profiler");InspectorBackend.registerEvent("Profiler.consoleProfileStarted",["id","location","title"]);InspectorBackend.registerEvent("Profiler.consoleProfileFinished",["id","location","profile","title"]);InspectorBackend.registerCommand("Profiler.enable",[],[],false);InspectorBackend.registerCommand("Profiler.disable",[],[],false);InspectorBackend.registerCommand("Profiler.setSamplingInterval",[{"name":"interval","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Profiler.start",[],[],false);InspectorBackend.registerCommand("Profiler.stop",[],["profile"],false);InspectorBackend.registerHeapProfilerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"HeapProfiler");InspectorBackend.registerEvent("HeapProfiler.addProfileHeader",["header"]);InspectorBackend.registerEvent("HeapProfiler.addHeapSnapshotChunk",["uid","chunk"]);InspectorBackend.registerEvent("HeapProfiler.resetProfiles",[]);InspectorBackend.registerEvent("HeapProfiler.reportHeapSnapshotProgress",["done","total"]);InspectorBackend.registerEvent("HeapProfiler.lastSeenObjectId",["lastSeenObjectId","timestamp"]);InspectorBackend.registerEvent("HeapProfiler.heapStatsUpdate",["statsUpdate"]);InspectorBackend.registerCommand("HeapProfiler.enable",[],[],false);InspectorBackend.registerCommand("HeapProfiler.disable",[],[],false);InspectorBackend.registerCommand("HeapProfiler.startTrackingHeapObjects",[],[],false);InspectorBackend.registerCommand("HeapProfiler.stopTrackingHeapObjects",[{"name":"reportProgress","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("HeapProfiler.getHeapSnapshot",[{"name":"uid","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("HeapProfiler.removeProfile",[{"name":"uid","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("HeapProfiler.clearProfiles",[],[],false);InspectorBackend.registerCommand("HeapProfiler.takeHeapSnapshot",[{"name":"reportProgress","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("HeapProfiler.collectGarbage",[],[],false);InspectorBackend.registerCommand("HeapProfiler.getObjectByHeapObjectId",[{"name":"objectId","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true}],["result"],false);InspectorBackend.registerCommand("HeapProfiler.getHeapObjectId",[{"name":"objectId","type":"string","optional":false}],["heapSnapshotObjectId"],false);InspectorBackend.registerWorkerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Worker");InspectorBackend.registerEvent("Worker.workerCreated",["workerId","url","inspectorConnected"]);InspectorBackend.registerEvent("Worker.workerTerminated",["workerId"]);InspectorBackend.registerEvent("Worker.dispatchMessageFromWorker",["workerId","message"]);InspectorBackend.registerEvent("Worker.disconnectedFromWorker",[]);InspectorBackend.registerCommand("Worker.enable",[],[],false);InspectorBackend.registerCommand("Worker.disable",[],[],false);InspectorBackend.registerCommand("Worker.sendMessageToWorker",[{"name":"workerId","type":"number","optional":false},{"name":"message","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("Worker.canInspectWorkers",[],["result"],false);InspectorBackend.registerCommand("Worker.connectToWorker",[{"name":"workerId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Worker.disconnectFromWorker",[{"name":"workerId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Worker.setAutoconnectToWorkers",[{"name":"value","type":"boolean","optional":false}],[],false);InspectorBackend.registerCanvasDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Canvas");InspectorBackend.registerEnum("Canvas.CallArgumentType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean"});InspectorBackend.registerEnum("Canvas.CallArgumentSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date"});InspectorBackend.registerEvent("Canvas.contextCreated",["frameId"]);InspectorBackend.registerEvent("Canvas.traceLogsRemoved",["frameId","traceLogId"]);InspectorBackend.registerCommand("Canvas.enable",[],[],false);InspectorBackend.registerCommand("Canvas.disable",[],[],false);InspectorBackend.registerCommand("Canvas.dropTraceLog",[{"name":"traceLogId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Canvas.hasUninstrumentedCanvases",[],["result"],false);InspectorBackend.registerCommand("Canvas.captureFrame",[{"name":"frameId","type":"string","optional":true}],["traceLogId"],false);InspectorBackend.registerCommand("Canvas.startCapturing",[{"name":"frameId","type":"string","optional":true}],["traceLogId"],false);InspectorBackend.registerCommand("Canvas.stopCapturing",[{"name":"traceLogId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Canvas.getTraceLog",[{"name":"traceLogId","type":"string","optional":false},{"name":"startOffset","type":"number","optional":true},{"name":"maxLength","type":"number","optional":true}],["traceLog"],false);InspectorBackend.registerCommand("Canvas.replayTraceLog",[{"name":"traceLogId","type":"string","optional":false},{"name":"stepNo","type":"number","optional":false}],["resourceState","replayTime"],false);InspectorBackend.registerCommand("Canvas.getResourceState",[{"name":"traceLogId","type":"string","optional":false},{"name":"resourceId","type":"string","optional":false}],["resourceState"],false);InspectorBackend.registerCommand("Canvas.evaluateTraceLogCallArgument",[{"name":"traceLogId","type":"string","optional":false},{"name":"callIndex","type":"number","optional":false},{"name":"argumentIndex","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["result","resourceState"],false);InspectorBackend.registerInputDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Input");InspectorBackend.registerEnum("Input.TouchPointState",{TouchPressed:"touchPressed",TouchReleased:"touchReleased",TouchMoved:"touchMoved",TouchStationary:"touchStationary",TouchCancelled:"touchCancelled"});InspectorBackend.registerCommand("Input.dispatchKeyEvent",[{"name":"type","type":"string","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true},{"name":"text","type":"string","optional":true},{"name":"unmodifiedText","type":"string","optional":true},{"name":"keyIdentifier","type":"string","optional":true},{"name":"windowsVirtualKeyCode","type":"number","optional":true},{"name":"nativeVirtualKeyCode","type":"number","optional":true},{"name":"macCharCode","type":"number","optional":true},{"name":"autoRepeat","type":"boolean","optional":true},{"name":"isKeypad","type":"boolean","optional":true},{"name":"isSystemKey","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Input.dispatchMouseEvent",[{"name":"type","type":"string","optional":false},{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true},{"name":"button","type":"string","optional":true},{"name":"clickCount","type":"number","optional":true},{"name":"deviceSpace","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Input.dispatchTouchEvent",[{"name":"type","type":"string","optional":false},{"name":"touchPoints","type":"object","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Input.dispatchGestureEvent",[{"name":"type","type":"string","optional":false},{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"timestamp","type":"number","optional":true},{"name":"deltaX","type":"number","optional":true},{"name":"deltaY","type":"number","optional":true},{"name":"pinchScale","type":"number","optional":true}],[],false);InspectorBackend.registerLayerTreeDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"LayerTree");InspectorBackend.registerEvent("LayerTree.layerTreeDidChange",["layers"]);InspectorBackend.registerEvent("LayerTree.layerPainted",["layerId","clip"]);InspectorBackend.registerCommand("LayerTree.enable",[],[],false);InspectorBackend.registerCommand("LayerTree.disable",[],[],false);InspectorBackend.registerCommand("LayerTree.compositingReasons",[{"name":"layerId","type":"string","optional":false}],["compositingReasons"],false);InspectorBackend.registerCommand("LayerTree.makeSnapshot",[{"name":"layerId","type":"string","optional":false}],["snapshotId"],false);InspectorBackend.registerCommand("LayerTree.releaseSnapshot",[{"name":"snapshotId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("LayerTree.profileSnapshot",[{"name":"snapshotId","type":"string","optional":false},{"name":"minRepeatCount","type":"number","optional":true},{"name":"minDuration","type":"number","optional":true}],["timings"],false);InspectorBackend.registerCommand("LayerTree.replaySnapshot",[{"name":"snapshotId","type":"string","optional":false},{"name":"fromStep","type":"number","optional":true},{"name":"toStep","type":"number","optional":true}],["dataURL"],false);InspectorBackend.registerTracingDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Tracing");InspectorBackend.registerEvent("Tracing.dataCollected",["value"]);InspectorBackend.registerEvent("Tracing.tracingComplete",[]);InspectorBackend.registerCommand("Tracing.start",[{"name":"categories","type":"string","optional":false},{"name":"options","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Tracing.end",[],[],false);if(!window.InspectorExtensionRegistry){WebInspector.InspectorExtensionRegistryStub=function()
1064 {}
1065 WebInspector.InspectorExtensionRegistryStub.prototype={getExtensionsAsync:function()
1066 {}}
1067 var InspectorExtensionRegistry=new WebInspector.InspectorExtensionRegistryStub();}
1068 var InspectorFrontendAPI={_pendingCommands:[],showConsole:function()
1069 {InspectorFrontendAPI._runOnceLoaded(function(){WebInspector.showPanel("console");});},enterInspectElementMode:function()
1070 {InspectorFrontendAPI._runOnceLoaded(function(){WebInspector.showPanel("elements");if(WebInspector.inspectElementModeController)
1071 WebInspector.inspectElementModeController.toggleSearch();});},revealSourceLine:function(url,lineNumber,columnNumber)
1072 {InspectorFrontendAPI._runOnceLoaded(function(){var uiSourceCode=WebInspector.workspace.uiSourceCodeForURL(url);if(uiSourceCode){WebInspector.showPanel("sources").showUISourceCode(uiSourceCode,lineNumber,columnNumber);return;}
1073 function listener(event)
1074 {var uiSourceCode=(event.data);if(uiSourceCode.url===url){WebInspector.showPanel("sources").showUISourceCode(uiSourceCode,lineNumber,columnNumber);WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,listener);}}
1075 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,listener);});},setToolbarColors:function(backgroundColor,color)
1076 {WebInspector.setToolbarColors(backgroundColor,color);},loadTimelineFromURL:function(url)
1077 {InspectorFrontendAPI._runOnceLoaded(function(){(WebInspector.showPanel("timeline")).loadFromURL(url);});},setUseSoftMenu:function(useSoftMenu)
1078 {WebInspector.ContextMenu.setUseSoftMenu(useSoftMenu);},setAttachedWindow:function(docked)
1079 {},setDockSide:function(side)
1080 {},dispatchMessage:function(messageObject)
1081 {InspectorBackend.dispatch(messageObject);},contextMenuItemSelected:function(id)
1082 {WebInspector.contextMenuItemSelected(id);},contextMenuCleared:function()
1083 {WebInspector.contextMenuCleared();},fileSystemsLoaded:function(fileSystems)
1084 {WebInspector.isolatedFileSystemDispatcher.fileSystemsLoaded(fileSystems);},fileSystemRemoved:function(fileSystemPath)
1085 {WebInspector.isolatedFileSystemDispatcher.fileSystemRemoved(fileSystemPath);},fileSystemAdded:function(errorMessage,fileSystem)
1086 {WebInspector.isolatedFileSystemDispatcher.fileSystemAdded(errorMessage,fileSystem);},indexingTotalWorkCalculated:function(requestId,fileSystemPath,totalWork)
1087 {var projectDelegate=WebInspector.fileSystemWorkspaceProvider.delegate(fileSystemPath);projectDelegate.indexingTotalWorkCalculated(requestId,totalWork);},indexingWorked:function(requestId,fileSystemPath,worked)
1088 {var projectDelegate=WebInspector.fileSystemWorkspaceProvider.delegate(fileSystemPath);projectDelegate.indexingWorked(requestId,worked);},indexingDone:function(requestId,fileSystemPath)
1089 {var projectDelegate=WebInspector.fileSystemWorkspaceProvider.delegate(fileSystemPath);projectDelegate.indexingDone(requestId);},searchCompleted:function(requestId,fileSystemPath,files)
1090 {var projectDelegate=WebInspector.fileSystemWorkspaceProvider.delegate(fileSystemPath);projectDelegate.searchCompleted(requestId,files);},savedURL:function(url)
1091 {WebInspector.fileManager.savedURL(url);},canceledSaveURL:function(url)
1092 {WebInspector.fileManager.canceledSaveURL(url);},appendedToURL:function(url)
1093 {WebInspector.fileManager.appendedToURL(url);},embedderMessageAck:function(id,error)
1094 {InspectorFrontendHost.embedderMessageAck(id,error);},loadCompleted:function()
1095 {InspectorFrontendAPI._isLoaded=true;for(var i=0;i<InspectorFrontendAPI._pendingCommands.length;++i)
1096 InspectorFrontendAPI._pendingCommands[i]();InspectorFrontendAPI._pendingCommands=[];if(window.opener)
1097 window.opener.postMessage(["loadCompleted"],"*");},dispatchQueryParameters:function(queryParamsObject)
1098 {if("dispatch"in queryParamsObject)
1099 InspectorFrontendAPI._dispatch(JSON.parse(window.decodeURI(queryParamsObject["dispatch"])));},evaluateForTest:function(callId,script)
1100 {WebInspector.evaluateForTestInFrontend(callId,script);},dispatchMessageAsync:function(messageObject)
1101 {WebInspector.dispatch(messageObject);},_dispatch:function(signature)
1102 {InspectorFrontendAPI._runOnceLoaded(function(){var methodName=signature.shift();return InspectorFrontendAPI[methodName].apply(InspectorFrontendAPI,signature);});},_runOnceLoaded:function(command)
1103 {if(InspectorFrontendAPI._isLoaded){command();return;}
1104 InspectorFrontendAPI._pendingCommands.push(command);}}
1105 function onMessageFromOpener(event)
1106 {if(event.source===window.opener)
1107 InspectorFrontendAPI._dispatch(event.data);}
1108 if(window.opener&&window.dispatchStandaloneTestRunnerMessages)
1109 window.addEventListener("message",onMessageFromOpener,true);WebInspector.Object=function(){}
1110 WebInspector.Object.prototype={addEventListener:function(eventType,listener,thisObject)
1111 {if(!listener)
1112 console.assert(false);if(!this._listeners)
1113 this._listeners={};if(!this._listeners[eventType])
1114 this._listeners[eventType]=[];this._listeners[eventType].push({thisObject:thisObject,listener:listener});},removeEventListener:function(eventType,listener,thisObject)
1115 {console.assert(listener);if(!this._listeners||!this._listeners[eventType])
1116 return;var listeners=this._listeners[eventType];for(var i=0;i<listeners.length;++i){if(listener&&listeners[i].listener===listener&&listeners[i].thisObject===thisObject)
1117 listeners.splice(i,1);else if(!listener&&thisObject&&listeners[i].thisObject===thisObject)
1118 listeners.splice(i,1);}
1119 if(!listeners.length)
1120 delete this._listeners[eventType];},removeAllListeners:function()
1121 {delete this._listeners;},hasEventListeners:function(eventType)
1122 {if(!this._listeners||!this._listeners[eventType])
1123 return false;return true;},dispatchEventToListeners:function(eventType,eventData)
1124 {if(!this._listeners||!this._listeners[eventType])
1125 return false;var event=new WebInspector.Event(this,eventType,eventData);var listeners=this._listeners[eventType].slice(0);for(var i=0;i<listeners.length;++i){listeners[i].listener.call(listeners[i].thisObject,event);if(event._stoppedPropagation)
1126 break;}
1127 return event.defaultPrevented;}}
1128 WebInspector.Event=function(target,type,data)
1129 {this.target=target;this.type=type;this.data=data;this.defaultPrevented=false;this._stoppedPropagation=false;}
1130 WebInspector.Event.prototype={stopPropagation:function()
1131 {this._stoppedPropagation=true;},preventDefault:function()
1132 {this.defaultPrevented=true;},consume:function(preventDefault)
1133 {this.stopPropagation();if(preventDefault)
1134 this.preventDefault();}}
1135 WebInspector.EventTarget=function()
1136 {}
1137 WebInspector.EventTarget.prototype={addEventListener:function(eventType,listener,thisObject){},removeEventListener:function(eventType,listener,thisObject){},removeAllListeners:function(){},hasEventListeners:function(eventType){},dispatchEventToListeners:function(eventType,eventData){},}
1138 WebInspector.notifications=new WebInspector.Object();var Preferences={maxInlineTextChildLength:80,minConsoleHeight:25,minSidebarWidth:100,minSidebarHeight:75,minElementsSidebarWidth:200,minElementsSidebarHeight:200,minScriptsSidebarWidth:200,applicationTitle:"Developer Tools - %s",experimentsEnabled:false}
1139 var Capabilities={canInspectWorkers:false,canScreencast:false}
1140 WebInspector.Settings=function()
1141 {this._eventSupport=new WebInspector.Object();this._registry=({});this.colorFormat=this.createSetting("colorFormat","original");this.consoleHistory=this.createSetting("consoleHistory",[]);this.domWordWrap=this.createSetting("domWordWrap",true);this.eventListenersFilter=this.createSetting("eventListenersFilter","all");this.lastViewedScriptFile=this.createSetting("lastViewedScriptFile","application");this.monitoringXHREnabled=this.createSetting("monitoringXHREnabled",false);this.preserveConsoleLog=this.createSetting("preserveConsoleLog",false);this.resourcesLargeRows=this.createSetting("resourcesLargeRows",true);this.resourcesSortOptions=this.createSetting("resourcesSortOptions",{timeOption:"responseTime",sizeOption:"transferSize"});this.resourceViewTab=this.createSetting("resourceViewTab","preview");this.showInheritedComputedStyleProperties=this.createSetting("showInheritedComputedStyleProperties",false);this.showUserAgentStyles=this.createSetting("showUserAgentStyles",true);this.watchExpressions=this.createSetting("watchExpressions",[]);this.breakpoints=this.createSetting("breakpoints",[]);this.eventListenerBreakpoints=this.createSetting("eventListenerBreakpoints",[]);this.domBreakpoints=this.createSetting("domBreakpoints",[]);this.xhrBreakpoints=this.createSetting("xhrBreakpoints",[]);this.jsSourceMapsEnabled=this.createSetting("sourceMapsEnabled",true);this.cssSourceMapsEnabled=this.createSetting("cssSourceMapsEnabled",true);this.cacheDisabled=this.createSetting("cacheDisabled",false);this.overrideUserAgent=this.createSetting("overrideUserAgent",false);this.userAgent=this.createSetting("userAgent","");this.overrideDeviceMetrics=this.createSetting("overrideDeviceMetrics",false);this.deviceMetrics=this.createSetting("deviceMetrics","");this.deviceFitWindow=this.createSetting("deviceFitWindow",true);this.emulateViewport=this.createSetting("emulateViewport",false);this.emulateTouchEvents=this.createSetting("emulateTouchEvents",false);this.showShadowDOM=this.createSetting("showShadowDOM",false);this.zoomLevel=this.createSetting("zoomLevel",0);this.externalZoomFactor=this.createSetting("externalZoomFactor",1);this.savedURLs=this.createSetting("savedURLs",{});this.javaScriptDisabled=this.createSetting("javaScriptDisabled",false);this.overrideGeolocation=this.createSetting("overrideGeolocation",false);this.geolocationOverride=this.createSetting("geolocationOverride","");this.overrideDeviceOrientation=this.createSetting("overrideDeviceOrientation",false);this.deviceOrientationOverride=this.createSetting("deviceOrientationOverride","");this.showAdvancedHeapSnapshotProperties=this.createSetting("showAdvancedHeapSnapshotProperties",false);this.highResolutionCpuProfiling=this.createSetting("highResolutionCpuProfiling",false);this.searchInContentScripts=this.createSetting("searchInContentScripts",false);this.textEditorIndent=this.createSetting("textEditorIndent","    ");this.textEditorAutoDetectIndent=this.createSetting("textEditorAutoIndentIndent",true);this.textEditorAutocompletion=this.createSetting("textEditorAutocompletion",true);this.textEditorBracketMatching=this.createSetting("textEditorBracketMatching",true);this.cssReloadEnabled=this.createSetting("cssReloadEnabled",false);this.timelineCaptureStacks=this.createSetting("timelineCaptureStacks",true);this.showMetricsRulers=this.createSetting("showMetricsRulers",false);this.overrideCSSMedia=this.createSetting("overrideCSSMedia",false);this.emulatedCSSMedia=this.createSetting("emulatedCSSMedia","print");this.workerInspectorWidth=this.createSetting("workerInspectorWidth",600);this.workerInspectorHeight=this.createSetting("workerInspectorHeight",600);this.messageURLFilters=this.createSetting("messageURLFilters",{});this.networkHideDataURL=this.createSetting("networkHideDataURL",false);this.messageLevelFilters=this.createSetting("messageLevelFilters",{});this.splitVerticallyWhenDockedToRight=this.createSetting("splitVerticallyWhenDockedToRight",true);this.visiblePanels=this.createSetting("visiblePanels",{});this.shortcutPanelSwitch=this.createSetting("shortcutPanelSwitch",false);this.showWhitespacesInEditor=this.createSetting("showWhitespacesInEditor",false);this.skipStackFramesSwitch=this.createSetting("skipStackFramesSwitch",false);this.skipStackFramesPattern=this.createSetting("skipStackFramesPattern","");this.showEmulationViewInDrawer=this.createSetting("showEmulationViewInDrawer",true);this.showRenderingViewInDrawer=this.createSetting("showRenderingViewInDrawer",true);this.enableAsyncStackTraces=this.createSetting("enableAsyncStackTraces",false);}
1142 WebInspector.Settings.prototype={createSetting:function(key,defaultValue)
1143 {if(!this._registry[key])
1144 this._registry[key]=new WebInspector.Setting(key,defaultValue,this._eventSupport,window.localStorage);return this._registry[key];},createBackendSetting:function(key,defaultValue,setterCallback)
1145 {if(!this._registry[key])
1146 this._registry[key]=new WebInspector.BackendSetting(key,defaultValue,this._eventSupport,window.localStorage,setterCallback);return this._registry[key];},initializeBackendSettings:function()
1147 {this.showPaintRects=WebInspector.settings.createBackendSetting("showPaintRects",false,PageAgent.setShowPaintRects.bind(PageAgent));this.showDebugBorders=WebInspector.settings.createBackendSetting("showDebugBorders",false,PageAgent.setShowDebugBorders.bind(PageAgent));this.continuousPainting=WebInspector.settings.createBackendSetting("continuousPainting",false,PageAgent.setContinuousPaintingEnabled.bind(PageAgent));this.showFPSCounter=WebInspector.settings.createBackendSetting("showFPSCounter",false,PageAgent.setShowFPSCounter.bind(PageAgent));this.showScrollBottleneckRects=WebInspector.settings.createBackendSetting("showScrollBottleneckRects",false,PageAgent.setShowScrollBottleneckRects.bind(PageAgent));}}
1148 WebInspector.Setting=function(name,defaultValue,eventSupport,storage)
1149 {this._name=name;this._defaultValue=defaultValue;this._eventSupport=eventSupport;this._storage=storage;}
1150 WebInspector.Setting.prototype={addChangeListener:function(listener,thisObject)
1151 {this._eventSupport.addEventListener(this._name,listener,thisObject);},removeChangeListener:function(listener,thisObject)
1152 {this._eventSupport.removeEventListener(this._name,listener,thisObject);},get name()
1153 {return this._name;},get:function()
1154 {if(typeof this._value!=="undefined")
1155 return this._value;this._value=this._defaultValue;if(this._storage&&this._name in this._storage){try{this._value=JSON.parse(this._storage[this._name]);}catch(e){delete this._storage[this._name];}}
1156 return this._value;},set:function(value)
1157 {this._value=value;if(this._storage){try{this._storage[this._name]=JSON.stringify(value);}catch(e){console.error("Error saving setting with name:"+this._name);}}
1158 this._eventSupport.dispatchEventToListeners(this._name,value);}}
1159 WebInspector.BackendSetting=function(name,defaultValue,eventSupport,storage,setterCallback)
1160 {WebInspector.Setting.call(this,name,defaultValue,eventSupport,storage);this._setterCallback=setterCallback;var currentValue=this.get();if(currentValue!==defaultValue)
1161 this.set(currentValue);}
1162 WebInspector.BackendSetting.prototype={set:function(value)
1163 {function callback(error)
1164 {if(error){WebInspector.log("Error applying setting "+this._name+": "+error);this._eventSupport.dispatchEventToListeners(this._name,this._value);return;}
1165 WebInspector.Setting.prototype.set.call(this,value);}
1166 this._setterCallback(value,callback.bind(this));},__proto__:WebInspector.Setting.prototype};WebInspector.ExperimentsSettings=function()
1167 {this._setting=WebInspector.settings.createSetting("experiments",{});this._experiments=[];this._enabledForTest={};this.fileSystemInspection=this._createExperiment("fileSystemInspection","FileSystem inspection");this.canvasInspection=this._createExperiment("canvasInspection ","Canvas inspection");this.cssRegions=this._createExperiment("cssRegions","CSS Regions Support");this.frameworksDebuggingSupport=this._createExperiment("frameworksDebuggingSupport","Enable frameworks debugging support");this.layersPanel=this._createExperiment("layersPanel","Show Layers panel");this.stepIntoSelection=this._createExperiment("stepIntoSelection","Show step-in candidates while debugging.");this.doNotOpenDrawerOnEsc=this._createExperiment("doNotOpenDrawerWithEsc","Do not open drawer on Esc");this.showEditorInDrawer=this._createExperiment("showEditorInDrawer","Show editor in drawer");this.gpuTimeline=this._createExperiment("gpuTimeline","Show GPU data on timeline");this.applyCustomStylesheet=this._createExperiment("applyCustomStylesheet","Allow custom UI themes");this._cleanUpSetting();}
1168 WebInspector.ExperimentsSettings.prototype={get experiments()
1169 {return this._experiments.slice();},get experimentsEnabled()
1170 {return Preferences.experimentsEnabled||("experiments"in WebInspector.queryParamsObject);},_createExperiment:function(experimentName,experimentTitle)
1171 {var experiment=new WebInspector.Experiment(this,experimentName,experimentTitle);this._experiments.push(experiment);return experiment;},isEnabled:function(experimentName)
1172 {if(this._enabledForTest[experimentName])
1173 return true;if(!this.experimentsEnabled)
1174 return false;var experimentsSetting=this._setting.get();return experimentsSetting[experimentName];},setEnabled:function(experimentName,enabled)
1175 {var experimentsSetting=this._setting.get();experimentsSetting[experimentName]=enabled;this._setting.set(experimentsSetting);},_enableForTest:function(experimentName)
1176 {this._enabledForTest[experimentName]=true;},_cleanUpSetting:function()
1177 {var experimentsSetting=this._setting.get();var cleanedUpExperimentSetting={};for(var i=0;i<this._experiments.length;++i){var experimentName=this._experiments[i].name;if(experimentsSetting[experimentName])
1178 cleanedUpExperimentSetting[experimentName]=true;}
1179 this._setting.set(cleanedUpExperimentSetting);}}
1180 WebInspector.Experiment=function(experimentsSettings,name,title)
1181 {this._name=name;this._title=title;this._experimentsSettings=experimentsSettings;}
1182 WebInspector.Experiment.prototype={get name()
1183 {return this._name;},get title()
1184 {return this._title;},isEnabled:function()
1185 {return this._experimentsSettings.isEnabled(this._name);},setEnabled:function(enabled)
1186 {this._experimentsSettings.setEnabled(this._name,enabled);},enableForTest:function()
1187 {this._experimentsSettings._enableForTest(this._name);}}
1188 WebInspector.VersionController=function()
1189 {}
1190 WebInspector.VersionController.currentVersion=4;WebInspector.VersionController.prototype={updateVersion:function()
1191 {var versionSetting=WebInspector.settings.createSetting("inspectorVersion",0);var currentVersion=WebInspector.VersionController.currentVersion;var oldVersion=versionSetting.get();var methodsToRun=this._methodsToRunToUpdateVersion(oldVersion,currentVersion);for(var i=0;i<methodsToRun.length;++i)
1192 this[methodsToRun[i]].call(this);versionSetting.set(currentVersion);},_methodsToRunToUpdateVersion:function(oldVersion,currentVersion)
1193 {var result=[];for(var i=oldVersion;i<currentVersion;++i)
1194 result.push("_updateVersionFrom"+i+"To"+(i+1));return result;},_updateVersionFrom0To1:function()
1195 {this._clearBreakpointsWhenTooMany(WebInspector.settings.breakpoints,500000);},_updateVersionFrom1To2:function()
1196 {var versionSetting=WebInspector.settings.createSetting("previouslyViewedFiles",[]);versionSetting.set([]);},_updateVersionFrom2To3:function()
1197 {var fileSystemMappingSetting=WebInspector.settings.createSetting("fileSystemMapping",{});fileSystemMappingSetting.set({});if(window.localStorage)
1198 delete window.localStorage["fileMappingEntries"];},_updateVersionFrom3To4:function()
1199 {var advancedMode=WebInspector.settings.createSetting("showHeaSnapshotObjectsHiddenProperties",false).get();WebInspector.settings.showAdvancedHeapSnapshotProperties.set(advancedMode);},_clearBreakpointsWhenTooMany:function(breakpointsSetting,maxBreakpointsCount)
1200 {if(breakpointsSetting.get().length>maxBreakpointsCount)
1201 breakpointsSetting.set([]);}}
1202 WebInspector.settings=new WebInspector.Settings();WebInspector.experimentsSettings=new WebInspector.ExperimentsSettings();WebInspector.View=function()
1203 {this.element=document.createElement("div");this.element.__view=this;this._visible=true;this._isRoot=false;this._isShowing=false;this._children=[];this._hideOnDetach=false;this._cssFiles=[];this._notificationDepth=0;}
1204 WebInspector.View._cssFileToVisibleViewCount={};WebInspector.View._cssFileToStyleElement={};WebInspector.View._cssUnloadTimeout=2000;WebInspector.View.prototype={markAsRoot:function()
1205 {WebInspector.View._assert(!this.element.parentElement,"Attempt to mark as root attached node");this._isRoot=true;},parentView:function()
1206 {return this._parentView;},isShowing:function()
1207 {return this._isShowing;},setHideOnDetach:function()
1208 {this._hideOnDetach=true;},_inNotification:function()
1209 {return!!this._notificationDepth||(this._parentView&&this._parentView._inNotification());},_parentIsShowing:function()
1210 {if(this._isRoot)
1211 return true;return this._parentView&&this._parentView.isShowing();},_callOnVisibleChildren:function(method)
1212 {var copy=this._children.slice();for(var i=0;i<copy.length;++i){if(copy[i]._parentView===this&&copy[i]._visible)
1213 method.call(copy[i]);}},_processWillShow:function()
1214 {this._loadCSSIfNeeded();this._callOnVisibleChildren(this._processWillShow);this._isShowing=true;},_processWasShown:function()
1215 {if(this._inNotification())
1216 return;this.restoreScrollPositions();this._notify(this.wasShown);this._notify(this.onResize);this._callOnVisibleChildren(this._processWasShown);},_processWillHide:function()
1217 {if(this._inNotification())
1218 return;this.storeScrollPositions();this._callOnVisibleChildren(this._processWillHide);this._notify(this.willHide);this._isShowing=false;},_processWasHidden:function()
1219 {this._disableCSSIfNeeded();this._callOnVisibleChildren(this._processWasHidden);},_processOnResize:function()
1220 {if(this._inNotification())
1221 return;if(!this.isShowing())
1222 return;this._notify(this.onResize);this._callOnVisibleChildren(this._processOnResize);},_notify:function(notification)
1223 {++this._notificationDepth;try{notification.call(this);}finally{--this._notificationDepth;}},wasShown:function()
1224 {},willHide:function()
1225 {},onResize:function()
1226 {},show:function(parentElement,insertBefore)
1227 {WebInspector.View._assert(parentElement,"Attempt to attach view with no parent element");if(this.element.parentElement!==parentElement){if(this.element.parentElement)
1228 this.detach();var currentParent=parentElement;while(currentParent&&!currentParent.__view)
1229 currentParent=currentParent.parentElement;if(currentParent){this._parentView=currentParent.__view;this._parentView._children.push(this);this._isRoot=false;}else
1230 WebInspector.View._assert(this._isRoot,"Attempt to attach view to orphan node");}else if(this._visible){return;}
1231 this._visible=true;if(this._parentIsShowing())
1232 this._processWillShow();this.element.classList.add("visible");if(this.element.parentElement!==parentElement){WebInspector.View._incrementViewCounter(parentElement,this.element);if(insertBefore)
1233 WebInspector.View._originalInsertBefore.call(parentElement,this.element,insertBefore);else
1234 WebInspector.View._originalAppendChild.call(parentElement,this.element);}
1235 if(this._parentIsShowing())
1236 this._processWasShown();},detach:function(overrideHideOnDetach)
1237 {var parentElement=this.element.parentElement;if(!parentElement)
1238 return;if(this._parentIsShowing())
1239 this._processWillHide();if(this._hideOnDetach&&!overrideHideOnDetach){this.element.classList.remove("visible");this._visible=false;if(this._parentIsShowing())
1240 this._processWasHidden();return;}
1241 WebInspector.View._decrementViewCounter(parentElement,this.element);WebInspector.View._originalRemoveChild.call(parentElement,this.element);this._visible=false;if(this._parentIsShowing())
1242 this._processWasHidden();if(this._parentView){var childIndex=this._parentView._children.indexOf(this);WebInspector.View._assert(childIndex>=0,"Attempt to remove non-child view");this._parentView._children.splice(childIndex,1);this._parentView=null;}else
1243 WebInspector.View._assert(this._isRoot,"Removing non-root view from DOM");},detachChildViews:function()
1244 {var children=this._children.slice();for(var i=0;i<children.length;++i)
1245 children[i].detach();},elementsToRestoreScrollPositionsFor:function()
1246 {return[this.element];},storeScrollPositions:function()
1247 {var elements=this.elementsToRestoreScrollPositionsFor();for(var i=0;i<elements.length;++i){var container=elements[i];container._scrollTop=container.scrollTop;container._scrollLeft=container.scrollLeft;}},restoreScrollPositions:function()
1248 {var elements=this.elementsToRestoreScrollPositionsFor();for(var i=0;i<elements.length;++i){var container=elements[i];if(container._scrollTop)
1249 container.scrollTop=container._scrollTop;if(container._scrollLeft)
1250 container.scrollLeft=container._scrollLeft;}},canHighlightPosition:function()
1251 {return false;},highlightPosition:function(line,column)
1252 {},doResize:function()
1253 {this._processOnResize();},registerRequiredCSS:function(cssFile)
1254 {if(window.flattenImports)
1255 cssFile=cssFile.split("/").reverse()[0];this._cssFiles.push(cssFile);},_loadCSSIfNeeded:function()
1256 {for(var i=0;i<this._cssFiles.length;++i){var cssFile=this._cssFiles[i];var viewsWithCSSFile=WebInspector.View._cssFileToVisibleViewCount[cssFile];WebInspector.View._cssFileToVisibleViewCount[cssFile]=(viewsWithCSSFile||0)+1;if(!viewsWithCSSFile)
1257 this._doLoadCSS(cssFile);}},_doLoadCSS:function(cssFile)
1258 {var styleElement=WebInspector.View._cssFileToStyleElement[cssFile];if(styleElement){styleElement.disabled=false;return;}
1259 if(window.debugCSS){styleElement=document.createElement("link");styleElement.rel="stylesheet";styleElement.type="text/css";styleElement.href=cssFile;}else{var xhr=new XMLHttpRequest();xhr.open("GET",cssFile,false);xhr.send(null);styleElement=document.createElement("style");styleElement.type="text/css";styleElement.textContent=xhr.responseText+this._buildSourceURL(cssFile);}
1260 document.head.insertBefore(styleElement,document.head.firstChild);WebInspector.View._cssFileToStyleElement[cssFile]=styleElement;},_buildSourceURL:function(cssFile)
1261 {return"\n/*# sourceURL="+WebInspector.ParsedURL.completeURL(window.location.href,cssFile)+" */";},_disableCSSIfNeeded:function()
1262 {var scheduleUnload=!!WebInspector.View._cssUnloadTimer;for(var i=0;i<this._cssFiles.length;++i){var cssFile=this._cssFiles[i];if(!--WebInspector.View._cssFileToVisibleViewCount[cssFile])
1263 scheduleUnload=true;}
1264 function doUnloadCSS()
1265 {delete WebInspector.View._cssUnloadTimer;for(cssFile in WebInspector.View._cssFileToVisibleViewCount){if(WebInspector.View._cssFileToVisibleViewCount.hasOwnProperty(cssFile)&&!WebInspector.View._cssFileToVisibleViewCount[cssFile])
1266 WebInspector.View._cssFileToStyleElement[cssFile].disabled=true;}}
1267 if(scheduleUnload){if(WebInspector.View._cssUnloadTimer)
1268 clearTimeout(WebInspector.View._cssUnloadTimer);WebInspector.View._cssUnloadTimer=setTimeout(doUnloadCSS,WebInspector.View._cssUnloadTimeout)}},printViewHierarchy:function()
1269 {var lines=[];this._collectViewHierarchy("",lines);console.log(lines.join("\n"));},_collectViewHierarchy:function(prefix,lines)
1270 {lines.push(prefix+"["+this.element.className+"]"+(this._children.length?" {":""));for(var i=0;i<this._children.length;++i)
1271 this._children[i]._collectViewHierarchy(prefix+"    ",lines);if(this._children.length)
1272 lines.push(prefix+"}");},defaultFocusedElement:function()
1273 {return this._defaultFocusedElement||this.element;},setDefaultFocusedElement:function(element)
1274 {this._defaultFocusedElement=element;},focus:function()
1275 {var element=this.defaultFocusedElement();if(!element||element.isAncestor(document.activeElement))
1276 return;WebInspector.setCurrentFocusElement(element);},measurePreferredSize:function()
1277 {this._loadCSSIfNeeded();WebInspector.View._originalAppendChild.call(document.body,this.element);this.element.positionAt(0,0);var result=new Size(this.element.offsetWidth,this.element.offsetHeight);this.element.positionAt(undefined,undefined);WebInspector.View._originalRemoveChild.call(document.body,this.element);this._disableCSSIfNeeded();return result;},__proto__:WebInspector.Object.prototype}
1278 WebInspector.View._originalAppendChild=Element.prototype.appendChild;WebInspector.View._originalInsertBefore=Element.prototype.insertBefore;WebInspector.View._originalRemoveChild=Element.prototype.removeChild;WebInspector.View._originalRemoveChildren=Element.prototype.removeChildren;WebInspector.View._incrementViewCounter=function(parentElement,childElement)
1279 {var count=(childElement.__viewCounter||0)+(childElement.__view?1:0);if(!count)
1280 return;while(parentElement){parentElement.__viewCounter=(parentElement.__viewCounter||0)+count;parentElement=parentElement.parentElement;}}
1281 WebInspector.View._decrementViewCounter=function(parentElement,childElement)
1282 {var count=(childElement.__viewCounter||0)+(childElement.__view?1:0);if(!count)
1283 return;while(parentElement){parentElement.__viewCounter-=count;parentElement=parentElement.parentElement;}}
1284 WebInspector.View._assert=function(condition,message)
1285 {if(!condition){console.trace();throw new Error(message);}}
1286 WebInspector.ViewWithResizeCallback=function(resizeCallback)
1287 {WebInspector.View.call(this);this._resizeCallback=resizeCallback;}
1288 WebInspector.ViewWithResizeCallback.prototype={onResize:function()
1289 {this._resizeCallback();},__proto__:WebInspector.View.prototype}
1290 Element.prototype.appendChild=function(child)
1291 {WebInspector.View._assert(!child.__view,"Attempt to add view via regular DOM operation.");return WebInspector.View._originalAppendChild.call(this,child);}
1292 Element.prototype.insertBefore=function(child,anchor)
1293 {WebInspector.View._assert(!child.__view,"Attempt to add view via regular DOM operation.");return WebInspector.View._originalInsertBefore.call(this,child,anchor);}
1294 Element.prototype.removeChild=function(child)
1295 {WebInspector.View._assert(!child.__viewCounter&&!child.__view,"Attempt to remove element containing view via regular DOM operation");return WebInspector.View._originalRemoveChild.call(this,child);}
1296 Element.prototype.removeChildren=function()
1297 {WebInspector.View._assert(!this.__viewCounter,"Attempt to remove element containing view via regular DOM operation");WebInspector.View._originalRemoveChildren.call(this);}
1298 WebInspector.installDragHandle=function(element,elementDragStart,elementDrag,elementDragEnd,cursor,hoverCursor)
1299 {element.addEventListener("mousedown",WebInspector.elementDragStart.bind(WebInspector,elementDragStart,elementDrag,elementDragEnd,cursor),false);if(hoverCursor!==null)
1300 element.style.cursor=hoverCursor||cursor;}
1301 WebInspector.elementDragStart=function(elementDragStart,elementDrag,elementDragEnd,cursor,event)
1302 {if(event.button||(WebInspector.isMac()&&event.ctrlKey))
1303 return;if(WebInspector._elementDraggingEventListener)
1304 return;if(elementDragStart&&!elementDragStart((event)))
1305 return;if(WebInspector._elementDraggingGlassPane){WebInspector._elementDraggingGlassPane.dispose();delete WebInspector._elementDraggingGlassPane;}
1306 var targetDocument=event.target.ownerDocument;WebInspector._elementDraggingEventListener=elementDrag;WebInspector._elementEndDraggingEventListener=elementDragEnd;WebInspector._mouseOutWhileDraggingTargetDocument=targetDocument;targetDocument.addEventListener("mousemove",WebInspector._elementDragMove,true);targetDocument.addEventListener("mouseup",WebInspector._elementDragEnd,true);targetDocument.addEventListener("mouseout",WebInspector._mouseOutWhileDragging,true);targetDocument.body.style.cursor=cursor;event.preventDefault();}
1307 WebInspector._mouseOutWhileDragging=function()
1308 {WebInspector._unregisterMouseOutWhileDragging();WebInspector._elementDraggingGlassPane=new WebInspector.GlassPane();}
1309 WebInspector._unregisterMouseOutWhileDragging=function()
1310 {if(!WebInspector._mouseOutWhileDraggingTargetDocument)
1311 return;WebInspector._mouseOutWhileDraggingTargetDocument.removeEventListener("mouseout",WebInspector._mouseOutWhileDragging,true);delete WebInspector._mouseOutWhileDraggingTargetDocument;}
1312 WebInspector._elementDragMove=function(event)
1313 {if(WebInspector._elementDraggingEventListener((event)))
1314 WebInspector._cancelDragEvents(event);}
1315 WebInspector._cancelDragEvents=function(event)
1316 {var targetDocument=event.target.ownerDocument;targetDocument.removeEventListener("mousemove",WebInspector._elementDragMove,true);targetDocument.removeEventListener("mouseup",WebInspector._elementDragEnd,true);WebInspector._unregisterMouseOutWhileDragging();targetDocument.body.style.removeProperty("cursor");if(WebInspector._elementDraggingGlassPane)
1317 WebInspector._elementDraggingGlassPane.dispose();delete WebInspector._elementDraggingGlassPane;delete WebInspector._elementDraggingEventListener;delete WebInspector._elementEndDraggingEventListener;}
1318 WebInspector._elementDragEnd=function(event)
1319 {var elementDragEnd=WebInspector._elementEndDraggingEventListener;WebInspector._cancelDragEvents((event));event.preventDefault();if(elementDragEnd)
1320 elementDragEnd((event));}
1321 WebInspector.GlassPane=function()
1322 {this.element=document.createElement("div");this.element.style.cssText="position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1000;";this.element.id="glass-pane";document.body.appendChild(this.element);WebInspector._glassPane=this;}
1323 WebInspector.GlassPane.prototype={dispose:function()
1324 {delete WebInspector._glassPane;if(WebInspector.HelpScreen.isVisible())
1325 WebInspector.HelpScreen.focus();else
1326 WebInspector.inspectorView.focus();this.element.remove();}}
1327 WebInspector.animateStyle=function(animations,duration,callback)
1328 {var startTime=new Date().getTime();var hasCompleted=false;const animationsLength=animations.length;const propertyUnit={opacity:""};const defaultUnit="px";for(var i=0;i<animationsLength;++i){var animation=animations[i];var element=null,start=null,end=null,key=null;for(key in animation){if(key==="element")
1329 element=animation[key];else if(key==="start")
1330 start=animation[key];else if(key==="end")
1331 end=animation[key];}
1332 if(!element||!end)
1333 continue;if(!start){var computedStyle=element.ownerDocument.defaultView.getComputedStyle(element);start={};for(key in end)
1334 start[key]=parseInt(computedStyle.getPropertyValue(key),10);animation.start=start;}else
1335 for(key in start)
1336 element.style.setProperty(key,start[key]+(key in propertyUnit?propertyUnit[key]:defaultUnit));}
1337 function animateLoop()
1338 {if(hasCompleted)
1339 return;var complete=new Date().getTime()-startTime;for(var i=0;i<animationsLength;++i){var animation=animations[i];var element=animation.element;var start=animation.start;var end=animation.end;if(!element||!end)
1340 continue;var style=element.style;for(key in end){var endValue=end[key];if(complete<duration){var startValue=start[key];var newValue=startValue+(endValue-startValue)*complete/duration;style.setProperty(key,newValue+(key in propertyUnit?propertyUnit[key]:defaultUnit));}else
1341 style.setProperty(key,endValue+(key in propertyUnit?propertyUnit[key]:defaultUnit));}}
1342 if(complete>=duration)
1343 hasCompleted=true;if(callback)
1344 callback(hasCompleted);if(!hasCompleted)
1345 window.requestAnimationFrame(animateLoop);}
1346 function forceComplete()
1347 {if(hasCompleted)
1348 return;duration=0;animateLoop();}
1349 window.requestAnimationFrame(animateLoop);return{forceComplete:forceComplete};}
1350 WebInspector.isBeingEdited=function(element)
1351 {if(element.classList.contains("text-prompt")||element.nodeName==="INPUT"||element.nodeName==="TEXTAREA")
1352 return true;if(!WebInspector.__editingCount)
1353 return false;while(element){if(element.__editing)
1354 return true;element=element.parentElement;}
1355 return false;}
1356 WebInspector.markBeingEdited=function(element,value)
1357 {if(value){if(element.__editing)
1358 return false;element.classList.add("being-edited");element.__editing=true;WebInspector.__editingCount=(WebInspector.__editingCount||0)+1;}else{if(!element.__editing)
1359 return false;element.classList.remove("being-edited");delete element.__editing;--WebInspector.__editingCount;}
1360 return true;}
1361 WebInspector.EditingConfig=function(commitHandler,cancelHandler,context)
1362 {this.commitHandler=commitHandler;this.cancelHandler=cancelHandler
1363 this.context=context;this.pasteHandler;this.multiline;this.customFinishHandler;}
1364 WebInspector.EditingConfig.prototype={setPasteHandler:function(pasteHandler)
1365 {this.pasteHandler=pasteHandler;},setMultilineOptions:function(initialValue,mode,theme,lineWrapping,smartIndent)
1366 {this.multiline=true;this.initialValue=initialValue;this.mode=mode;this.theme=theme;this.lineWrapping=lineWrapping;this.smartIndent=smartIndent;},setCustomFinishHandler:function(customFinishHandler)
1367 {this.customFinishHandler=customFinishHandler;}}
1368 WebInspector.CSSNumberRegex=/^(-?(?:\d+(?:\.\d+)?|\.\d+))$/;WebInspector.StyleValueDelimiters=" \xA0\t\n\"':;,/()";WebInspector._valueModificationDirection=function(event)
1369 {var direction=null;if(event.type==="mousewheel"){if(event.wheelDeltaY>0)
1370 direction="Up";else if(event.wheelDeltaY<0)
1371 direction="Down";}else{if(event.keyIdentifier==="Up"||event.keyIdentifier==="PageUp")
1372 direction="Up";else if(event.keyIdentifier==="Down"||event.keyIdentifier==="PageDown")
1373 direction="Down";}
1374 return direction;}
1375 WebInspector._modifiedHexValue=function(hexString,event)
1376 {var direction=WebInspector._valueModificationDirection(event);if(!direction)
1377 return hexString;var number=parseInt(hexString,16);if(isNaN(number)||!isFinite(number))
1378 return hexString;var maxValue=Math.pow(16,hexString.length)-1;var arrowKeyOrMouseWheelEvent=(event.keyIdentifier==="Up"||event.keyIdentifier==="Down"||event.type==="mousewheel");var delta;if(arrowKeyOrMouseWheelEvent)
1379 delta=(direction==="Up")?1:-1;else
1380 delta=(event.keyIdentifier==="PageUp")?16:-16;if(event.shiftKey)
1381 delta*=16;var result=number+delta;if(result<0)
1382 result=0;else if(result>maxValue)
1383 return hexString;var resultString=result.toString(16).toUpperCase();for(var i=0,lengthDelta=hexString.length-resultString.length;i<lengthDelta;++i)
1384 resultString="0"+resultString;return resultString;}
1385 WebInspector._modifiedFloatNumber=function(number,event)
1386 {var direction=WebInspector._valueModificationDirection(event);if(!direction)
1387 return number;var arrowKeyOrMouseWheelEvent=(event.keyIdentifier==="Up"||event.keyIdentifier==="Down"||event.type==="mousewheel");var changeAmount=1;if(event.shiftKey&&!arrowKeyOrMouseWheelEvent)
1388 changeAmount=100;else if(event.shiftKey||!arrowKeyOrMouseWheelEvent)
1389 changeAmount=10;else if(event.altKey)
1390 changeAmount=0.1;if(direction==="Down")
1391 changeAmount*=-1;var result=Number((number+changeAmount).toFixed(6));if(!String(result).match(WebInspector.CSSNumberRegex))
1392 return null;return result;}
1393 WebInspector.handleElementValueModifications=function(event,element,finishHandler,suggestionHandler,customNumberHandler)
1394 {var arrowKeyOrMouseWheelEvent=(event.keyIdentifier==="Up"||event.keyIdentifier==="Down"||event.type==="mousewheel");var pageKeyPressed=(event.keyIdentifier==="PageUp"||event.keyIdentifier==="PageDown");if(!arrowKeyOrMouseWheelEvent&&!pageKeyPressed)
1395 return false;var selection=window.getSelection();if(!selection.rangeCount)
1396 return false;var selectionRange=selection.getRangeAt(0);if(!selectionRange.commonAncestorContainer.isSelfOrDescendant(element))
1397 return false;var originalValue=element.textContent;var wordRange=selectionRange.startContainer.rangeOfWord(selectionRange.startOffset,WebInspector.StyleValueDelimiters,element);var wordString=wordRange.toString();if(suggestionHandler&&suggestionHandler(wordString))
1398 return false;var replacementString;var prefix,suffix,number;var matches;matches=/(.*#)([\da-fA-F]+)(.*)/.exec(wordString);if(matches&&matches.length){prefix=matches[1];suffix=matches[3];number=WebInspector._modifiedHexValue(matches[2],event);if(customNumberHandler)
1399 number=customNumberHandler(number);replacementString=prefix+number+suffix;}else{matches=/(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/.exec(wordString);if(matches&&matches.length){prefix=matches[1];suffix=matches[3];number=WebInspector._modifiedFloatNumber(parseFloat(matches[2]),event);if(number===null)
1400 return false;if(customNumberHandler)
1401 number=customNumberHandler(number);replacementString=prefix+number+suffix;}}
1402 if(replacementString){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();if(finishHandler)
1403 finishHandler(originalValue,replacementString);return true;}
1404 return false;}
1405 WebInspector.startEditing=function(element,config)
1406 {if(!WebInspector.markBeingEdited(element,true))
1407 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 isMultiline=config.multiline||false;var oldText=isMultiline?config.initialValue:getContent(element);var moveDirection="";var oldTabIndex;var codeMirror;var cssLoadView;function consumeCopy(e)
1408 {e.consume();}
1409 if(isMultiline){loadScript("CodeMirrorTextEditor.js");cssLoadView=new WebInspector.CodeMirrorCSSLoadView();cssLoadView.show(element);WebInspector.setCurrentFocusElement(element);element.addEventListener("copy",consumeCopy,false);codeMirror=window.CodeMirror(element,{mode:config.mode,lineWrapping:config.lineWrapping,smartIndent:config.smartIndent,autofocus:true,theme:config.theme,value:oldText});codeMirror.getWrapperElement().classList.add("source-code");codeMirror.on("cursorActivity",function(cm){cm.display.cursor.scrollIntoViewIfNeeded(false);});}else{element.classList.add("editing");oldTabIndex=element.getAttribute("tabIndex");if(typeof oldTabIndex!=="number"||oldTabIndex<0)
1410 element.tabIndex=0;WebInspector.setCurrentFocusElement(element);}
1411 function setWidth(width)
1412 {const padding=30;codeMirror.getWrapperElement().style.width=(width-codeMirror.getWrapperElement().offsetLeft-padding)+"px";codeMirror.refresh();}
1413 function blurEventListener(e){if(!isMultiline||!e||!e.relatedTarget||!e.relatedTarget.isSelfOrDescendant(element))
1414 editingCommitted.call(element);}
1415 function getContent(element){if(isMultiline)
1416 return codeMirror.getValue();if(element.tagName==="INPUT"&&element.type==="text")
1417 return element.value;return element.textContent;}
1418 function cleanUpAfterEditing()
1419 {WebInspector.markBeingEdited(element,false);element.removeEventListener("blur",blurEventListener,isMultiline);element.removeEventListener("keydown",keyDownEventListener,true);if(pasteCallback)
1420 element.removeEventListener("paste",pasteEventListener,true);WebInspector.restoreFocusFromElement(element);if(isMultiline){element.removeEventListener("copy",consumeCopy,false);cssLoadView.detach();return;}
1421 this.classList.remove("editing");if(typeof oldTabIndex!=="number")
1422 element.removeAttribute("tabIndex");else
1423 this.tabIndex=oldTabIndex;this.scrollTop=0;this.scrollLeft=0;}
1424 function editingCancelled()
1425 {if(isMultiline)
1426 codeMirror.setValue(oldText);else{if(this.tagName==="INPUT"&&this.type==="text")
1427 this.value=oldText;else
1428 this.textContent=oldText;}
1429 cleanUpAfterEditing.call(this);cancelledCallback(this,context);}
1430 function editingCommitted()
1431 {cleanUpAfterEditing.call(this);committedCallback(this,getContent(this),oldText,context,moveDirection);}
1432 function defaultFinishHandler(event)
1433 {var isMetaOrCtrl=WebInspector.isMac()?event.metaKey&&!event.shiftKey&&!event.ctrlKey&&!event.altKey:event.ctrlKey&&!event.shiftKey&&!event.metaKey&&!event.altKey;if(isEnterKey(event)&&(event.isMetaOrCtrlForTest||!isMultiline||isMetaOrCtrl))
1434 return"commit";else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code||event.keyIdentifier==="U+001B")
1435 return"cancel";else if(!isMultiline&&event.keyIdentifier==="U+0009")
1436 return"move-"+(event.shiftKey?"backward":"forward");}
1437 function handleEditingResult(result,event)
1438 {if(result==="commit"){editingCommitted.call(element);event.consume(true);}else if(result==="cancel"){editingCancelled.call(element);event.consume(true);}else if(result&&result.startsWith("move-")){moveDirection=result.substring(5);if(event.keyIdentifier!=="U+0009")
1439 blurEventListener();}}
1440 function pasteEventListener(event)
1441 {var result=pasteCallback(event);handleEditingResult(result,event);}
1442 function keyDownEventListener(event)
1443 {var handler=config.customFinishHandler||defaultFinishHandler;var result=handler(event);handleEditingResult(result,event);}
1444 element.addEventListener("blur",blurEventListener,isMultiline);element.addEventListener("keydown",keyDownEventListener,true);if(pasteCallback)
1445 element.addEventListener("paste",pasteEventListener,true);return{cancel:editingCancelled.bind(element),commit:editingCommitted.bind(element),codeMirror:codeMirror,setWidth:setWidth};}
1446 Number.secondsToString=function(seconds,higherResolution)
1447 {if(!isFinite(seconds))
1448 return"-";if(seconds===0)
1449 return"0";var ms=seconds*1000;if(higherResolution&&ms<1000)
1450 return WebInspector.UIString("%.3f\u2009ms",ms);else if(ms<1000)
1451 return WebInspector.UIString("%.0f\u2009ms",ms);if(seconds<60)
1452 return WebInspector.UIString("%.2f\u2009s",seconds);var minutes=seconds/60;if(minutes<60)
1453 return WebInspector.UIString("%.1f\u2009min",minutes);var hours=minutes/60;if(hours<24)
1454 return WebInspector.UIString("%.1f\u2009hrs",hours);var days=hours/24;return WebInspector.UIString("%.1f\u2009days",days);}
1455 Number.bytesToString=function(bytes)
1456 {if(bytes<1024)
1457 return WebInspector.UIString("%.0f\u2009B",bytes);var kilobytes=bytes/1024;if(kilobytes<100)
1458 return WebInspector.UIString("%.1f\u2009KB",kilobytes);if(kilobytes<1024)
1459 return WebInspector.UIString("%.0f\u2009KB",kilobytes);var megabytes=kilobytes/1024;if(megabytes<100)
1460 return WebInspector.UIString("%.1f\u2009MB",megabytes);else
1461 return WebInspector.UIString("%.0f\u2009MB",megabytes);}
1462 Number.withThousandsSeparator=function(num)
1463 {var str=num+"";var re=/(\d+)(\d{3})/;while(str.match(re))
1464 str=str.replace(re,"$1\u2009$2");return str;}
1465 WebInspector.useLowerCaseMenuTitles=function()
1466 {return WebInspector.platform()==="windows";}
1467 WebInspector.formatLocalized=function(format,substitutions,formatters,initialValue,append)
1468 {return String.format(WebInspector.UIString(format),substitutions,formatters,initialValue,append);}
1469 WebInspector.openLinkExternallyLabel=function()
1470 {return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Open link in new tab":"Open Link in New Tab");}
1471 WebInspector.copyLinkAddressLabel=function()
1472 {return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy link address":"Copy Link Address");}
1473 WebInspector.installPortStyles=function()
1474 {var platform=WebInspector.platform();document.body.classList.add("platform-"+platform);var flavor=WebInspector.platformFlavor();if(flavor)
1475 document.body.classList.add("platform-"+flavor);var port=WebInspector.port();document.body.classList.add("port-"+port);}
1476 WebInspector._windowFocused=function(event)
1477 {if(event.target.document.nodeType===Node.DOCUMENT_NODE)
1478 document.body.classList.remove("inactive");}
1479 WebInspector._windowBlurred=function(event)
1480 {if(event.target.document.nodeType===Node.DOCUMENT_NODE)
1481 document.body.classList.add("inactive");}
1482 WebInspector.previousFocusElement=function()
1483 {return WebInspector._previousFocusElement;}
1484 WebInspector.currentFocusElement=function()
1485 {return WebInspector._currentFocusElement;}
1486 WebInspector._focusChanged=function(event)
1487 {WebInspector.setCurrentFocusElement(event.target);}
1488 WebInspector._textInputTypes=["text","search","tel","url","email","password"].keySet();WebInspector._isTextEditingElement=function(element)
1489 {if(element instanceof HTMLInputElement)
1490 return element.type in WebInspector._textInputTypes;if(element instanceof HTMLTextAreaElement)
1491 return true;return false;}
1492 WebInspector.setCurrentFocusElement=function(x)
1493 {if(WebInspector._glassPane&&x&&!WebInspector._glassPane.element.isAncestor(x))
1494 return;if(WebInspector._currentFocusElement!==x)
1495 WebInspector._previousFocusElement=WebInspector._currentFocusElement;WebInspector._currentFocusElement=x;if(WebInspector._currentFocusElement){WebInspector._currentFocusElement.focus();var selection=window.getSelection();if(!WebInspector._isTextEditingElement(WebInspector._currentFocusElement)&&selection.isCollapsed&&!WebInspector._currentFocusElement.isInsertionCaretInside()){var selectionRange=WebInspector._currentFocusElement.ownerDocument.createRange();selectionRange.setStart(WebInspector._currentFocusElement,0);selectionRange.setEnd(WebInspector._currentFocusElement,0);selection.removeAllRanges();selection.addRange(selectionRange);}}else if(WebInspector._previousFocusElement)
1496 WebInspector._previousFocusElement.blur();}
1497 WebInspector.restoreFocusFromElement=function(element)
1498 {if(element&&element.isSelfOrAncestor(WebInspector.currentFocusElement()))
1499 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement());}
1500 WebInspector.setToolbarColors=function(backgroundColor,color)
1501 {if(!WebInspector._themeStyleElement){WebInspector._themeStyleElement=document.createElement("style");document.head.appendChild(WebInspector._themeStyleElement);}
1502 var parsedColor=WebInspector.Color.parse(color);var shadowColor=parsedColor?parsedColor.invert().setAlpha(0.33).toString(WebInspector.Color.Format.RGBA):"white";var prefix=WebInspector.isMac()?"body:not(.undocked)":"";WebInspector._themeStyleElement.textContent=String.sprintf("%s .toolbar-background {\
1503                  background-image: none !important;\
1504                  background-color: %s !important;\
1505                  color: %s !important;\
1506              }",prefix,backgroundColor,color)+
1507 String.sprintf("%s .toolbar-background button.status-bar-item .glyph, %s .toolbar-background button.status-bar-item .long-click-glyph {\
1508                  background-color: %s;\
1509              }",prefix,prefix,color)+
1510 String.sprintf("%s .toolbar-background button.status-bar-item .glyph.shadow, %s .toolbar-background button.status-bar-item .long-click-glyph.shadow {\
1511                  background-color: %s;\
1512              }",prefix,prefix,shadowColor);}
1513 WebInspector.resetToolbarColors=function()
1514 {if(WebInspector._themeStyleElement)
1515 WebInspector._themeStyleElement.textContent="";}
1516 WebInspector.highlightSearchResult=function(element,offset,length,domChanges)
1517 {var result=WebInspector.highlightSearchResults(element,[new WebInspector.SourceRange(offset,length)],domChanges);return result.length?result[0]:null;}
1518 WebInspector.highlightSearchResults=function(element,resultRanges,changes)
1519 {return WebInspector.highlightRangesWithStyleClass(element,resultRanges,"highlighted-search-result",changes);}
1520 WebInspector.highlightRangesWithStyleClass=function(element,resultRanges,styleClass,changes)
1521 {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)
1522 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);}
1523 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)
1524 startIndex++;var endIndex=startIndex;while(endIndex<snapshotLength&&nodeRanges[endIndex].offset+nodeRanges[endIndex].length<endOffset)
1525 endIndex++;if(endIndex===snapshotLength)
1526 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});}}
1527 startIndex=endIndex;nodeRanges[startIndex].offset=endOffset;nodeRanges[startIndex].length=lastTextNode.textContent.length;}
1528 return highlightNodes;}
1529 WebInspector.applyDomChanges=function(domChanges)
1530 {for(var i=0,size=domChanges.length;i<size;++i){var entry=domChanges[i];switch(entry.type){case"added":entry.parent.insertBefore(entry.node,entry.nextSibling);break;case"changed":entry.node.textContent=entry.newText;break;}}}
1531 WebInspector.revertDomChanges=function(domChanges)
1532 {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;}}}
1533 WebInspector._coalescingLevel=0;WebInspector.startBatchUpdate=function()
1534 {if(!WebInspector._coalescingLevel)
1535 WebInspector._postUpdateHandlers=new Map();WebInspector._coalescingLevel++;}
1536 WebInspector.endBatchUpdate=function()
1537 {if(--WebInspector._coalescingLevel)
1538 return;var handlers=WebInspector._postUpdateHandlers;delete WebInspector._postUpdateHandlers;var keys=handlers.keys();for(var i=0;i<keys.length;++i){var object=keys[i];var methods=handlers.get(object).keys();for(var j=0;j<methods.length;++j)
1539 methods[j].call(object);}}
1540 WebInspector.invokeOnceAfterBatchUpdate=function(object,method)
1541 {if(!WebInspector._coalescingLevel){method.call(object);return;}
1542 var methods=WebInspector._postUpdateHandlers.get(object);if(!methods){methods=new Map();WebInspector._postUpdateHandlers.put(object,methods);}
1543 methods.put(method);}
1544 WebInspector.CodeMirrorCSSLoadView=function()
1545 {WebInspector.View.call(this);this.element.classList.add("hidden");this.registerRequiredCSS("cm/codemirror.css");this.registerRequiredCSS("cm/cmdevtools.css");}
1546 WebInspector.CodeMirrorCSSLoadView.prototype={__proto__:WebInspector.View.prototype};(function(){function windowLoaded()
1547 {window.addEventListener("focus",WebInspector._windowFocused,false);window.addEventListener("blur",WebInspector._windowBlurred,false);document.addEventListener("focus",WebInspector._focusChanged.bind(this),true);window.removeEventListener("DOMContentLoaded",windowLoaded,false);}
1548 window.addEventListener("DOMContentLoaded",windowLoaded,false);})();WebInspector.HelpScreen=function(title)
1549 {WebInspector.View.call(this);this.markAsRoot();this.registerRequiredCSS("helpScreen.css");this.element.className="help-window-outer";this.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this.element.tabIndex=0;if(title){var mainWindow=this.element.createChild("div","help-window-main");var captionWindow=mainWindow.createChild("div","help-window-caption");captionWindow.appendChild(this._createCloseButton());this.contentElement=mainWindow.createChild("div","help-content");captionWindow.createChild("h1","help-window-title").textContent=title;}}
1550 WebInspector.HelpScreen._visibleScreen=null;WebInspector.HelpScreen.isVisible=function()
1551 {return!!WebInspector.HelpScreen._visibleScreen;}
1552 WebInspector.HelpScreen.focus=function()
1553 {WebInspector.HelpScreen._visibleScreen.element.focus();}
1554 WebInspector.HelpScreen.prototype={_createCloseButton:function()
1555 {var closeButton=document.createElement("div");closeButton.className="help-close-button close-button-gray";closeButton.addEventListener("click",this.hide.bind(this),false);return closeButton;},showModal:function()
1556 {var visibleHelpScreen=WebInspector.HelpScreen._visibleScreen;if(visibleHelpScreen===this)
1557 return;if(visibleHelpScreen)
1558 visibleHelpScreen.hide();WebInspector.HelpScreen._visibleScreen=this;this.show(WebInspector.inspectorView.devtoolsElement());this.focus();},hide:function()
1559 {if(!this.isShowing())
1560 return;WebInspector.HelpScreen._visibleScreen=null;WebInspector.restoreFocusFromElement(this.element);this.detach();},isClosingKey:function(keyCode)
1561 {return[WebInspector.KeyboardShortcut.Keys.Enter.code,WebInspector.KeyboardShortcut.Keys.Esc.code,WebInspector.KeyboardShortcut.Keys.Space.code,].indexOf(keyCode)>=0;},_onKeyDown:function(event)
1562 {if(this.isShowing()&&this.isClosingKey(event.keyCode)){this.hide();event.consume();}},__proto__:WebInspector.View.prototype}
1563 WebInspector.RemoteDebuggingTerminatedScreen=function(reason)
1564 {WebInspector.HelpScreen.call(this,WebInspector.UIString("Detached from the target"));var p=this.contentElement.createChild("p");p.classList.add("help-section");p.createChild("span").textContent=WebInspector.UIString("Remote debugging has been terminated with reason: ");p.createChild("span","error-message").textContent=reason;p.createChild("br");p.createChild("span").textContent=WebInspector.UIString("Please re-attach to the new target.");}
1565 WebInspector.RemoteDebuggingTerminatedScreen.prototype={__proto__:WebInspector.HelpScreen.prototype}
1566 function dispatchMethodByName(methodName)
1567 {var callId=++lastCallId;var argsArray=Array.prototype.slice.call(arguments,1);var callback=argsArray[argsArray.length-1];if(typeof callback==="function"){argsArray.pop();InspectorFrontendHost._callbacks[callId]=callback;}
1568 var message={"id":callId,"method":methodName};if(argsArray.length)
1569 message.params=argsArray;InspectorFrontendHost.sendMessageToEmbedder(JSON.stringify(message));}
1570 if(!window.InspectorFrontendHost){WebInspector.InspectorFrontendHostStub=function()
1571 {this.isStub=true;}
1572 WebInspector.InspectorFrontendHostStub.prototype={getSelectionBackgroundColor:function()
1573 {return"#6e86ff";},getSelectionForegroundColor:function()
1574 {return"#ffffff";},platform:function()
1575 {var match=navigator.userAgent.match(/Windows NT/);if(match)
1576 return"windows";match=navigator.userAgent.match(/Mac OS X/);if(match)
1577 return"mac";return"linux";},port:function()
1578 {return"unknown";},bringToFront:function()
1579 {this._windowVisible=true;},closeWindow:function()
1580 {this._windowVisible=false;},requestSetDockSide:function(side)
1581 {},setContentsInsets:function(top,left,bottom,right)
1582 {},moveWindowBy:function(x,y)
1583 {},setInjectedScriptForOrigin:function(origin,script)
1584 {},loaded:function()
1585 {},localizedStringsURL:function()
1586 {},inspectedURLChanged:function(url)
1587 {document.title=WebInspector.UIString(Preferences.applicationTitle,url);},copyText:function(text)
1588 {WebInspector.log("Clipboard is not enabled in hosted mode. Please inspect using chrome://inspect",WebInspector.ConsoleMessage.MessageLevel.Error,true);},openInNewTab:function(url)
1589 {window.open(url,"_blank");},save:function(url,content,forceSaveAs)
1590 {WebInspector.log("Saving files is not enabled in hosted mode. Please inspect using chrome://inspect",WebInspector.ConsoleMessage.MessageLevel.Error,true);WebInspector.fileManager.canceledSaveURL(url);},append:function(url,content)
1591 {WebInspector.log("Saving files is not enabled in hosted mode. Please inspect using chrome://inspect",WebInspector.ConsoleMessage.MessageLevel.Error,true);},sendMessageToBackend:function(message)
1592 {},sendMessageToEmbedder:function(message)
1593 {},recordActionTaken:function(actionCode)
1594 {},recordPanelShown:function(panelCode)
1595 {},recordSettingChanged:function(settingCode)
1596 {},supportsFileSystems:function()
1597 {return false;},requestFileSystems:function()
1598 {},addFileSystem:function()
1599 {},removeFileSystem:function(fileSystemPath)
1600 {},isolatedFileSystem:function(fileSystemId,registeredName)
1601 {return null;},upgradeDraggedFileSystemPermissions:function(domFileSystem)
1602 {},indexPath:function(requestId,fileSystemPath)
1603 {},stopIndexing:function(requestId)
1604 {},searchInPath:function(requestId,fileSystemPath,query)
1605 {},setZoomFactor:function(zoom)
1606 {},zoomFactor:function()
1607 {return 1;},isUnderTest:function()
1608 {return false;}}
1609 InspectorFrontendHost=new WebInspector.InspectorFrontendHostStub();}else if(InspectorFrontendHost.sendMessageToEmbedder){var lastCallId=0;InspectorFrontendHost._callbacks=[];InspectorFrontendHost.embedderMessageAck=function(id,error)
1610 {var callback=InspectorFrontendHost._callbacks[id];delete InspectorFrontendHost._callbacks[id];if(callback)
1611 callback(error);}
1612 var methodList=["addFileSystem","append","bringToFront","closeWindow","indexPath","moveWindowBy","openInNewTab","removeFileSystem","requestFileSystems","requestSetDockSide","save","searchInPath","setContentsInsets","stopIndexing"];for(var i=0;i<methodList.length;++i)
1613 InspectorFrontendHost[methodList[i]]=dispatchMethodByName.bind(null,methodList[i]);}
1614 WebInspector.FileManager=function()
1615 {this._saveCallbacks={};}
1616 WebInspector.FileManager.EventTypes={SavedURL:"SavedURL",AppendedToURL:"AppendedToURL"}
1617 WebInspector.FileManager.prototype={canSave:function()
1618 {return true;},save:function(url,content,forceSaveAs,callback)
1619 {var savedURLs=WebInspector.settings.savedURLs.get();delete savedURLs[url];WebInspector.settings.savedURLs.set(savedURLs);this._saveCallbacks[url]=callback||null;InspectorFrontendHost.save(url,content,forceSaveAs);},savedURL:function(url)
1620 {var savedURLs=WebInspector.settings.savedURLs.get();savedURLs[url]=true;WebInspector.settings.savedURLs.set(savedURLs);this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.SavedURL,url);this._invokeSaveCallback(url,true);},_invokeSaveCallback:function(url,accepted)
1621 {var callback=this._saveCallbacks[url];delete this._saveCallbacks[url];if(callback)
1622 callback(accepted);},canceledSaveURL:function(url)
1623 {this._invokeSaveCallback(url,false);},isURLSaved:function(url)
1624 {var savedURLs=WebInspector.settings.savedURLs.get();return savedURLs[url];},append:function(url,content)
1625 {InspectorFrontendHost.append(url,content);},close:function(url)
1626 {},appendedToURL:function(url)
1627 {this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.AppendedToURL,url);},__proto__:WebInspector.Object.prototype}
1628 WebInspector.fileManager=new WebInspector.FileManager();WebInspector.Checkbox=function(label,className,tooltip)
1629 {this.element=document.createElement('label');this._inputElement=document.createElement('input');this._inputElement.type="checkbox";this.element.className=className;this.element.appendChild(this._inputElement);this.element.appendChild(document.createTextNode(label));if(tooltip)
1630 this.element.title=tooltip;}
1631 WebInspector.Checkbox.prototype={set checked(checked)
1632 {this._inputElement.checked=checked;},get checked()
1633 {return this._inputElement.checked;},addEventListener:function(listener)
1634 {function listenerWrapper(event)
1635 {if(listener)
1636 listener(event);event.consume();return true;}
1637 this._inputElement.addEventListener("click",listenerWrapper,false);this.element.addEventListener("click",listenerWrapper,false);}}
1638 WebInspector.ContextMenuItem=function(topLevelMenu,type,label,disabled,checked)
1639 {this._type=type;this._label=label;this._disabled=disabled;this._checked=checked;this._contextMenu=topLevelMenu;if(type==="item"||type==="checkbox")
1640 this._id=topLevelMenu.nextId();}
1641 WebInspector.ContextMenuItem.prototype={id:function()
1642 {return this._id;},type:function()
1643 {return this._type;},isEnabled:function()
1644 {return!this._disabled;},setEnabled:function(enabled)
1645 {this._disabled=!enabled;},_buildDescriptor:function()
1646 {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};}}}
1647 WebInspector.ContextSubMenuItem=function(topLevelMenu,label,disabled)
1648 {WebInspector.ContextMenuItem.call(this,topLevelMenu,"subMenu",label,disabled);this._items=[];}
1649 WebInspector.ContextSubMenuItem.prototype={appendItem:function(label,handler,disabled)
1650 {var item=new WebInspector.ContextMenuItem(this._contextMenu,"item",label,disabled);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;},appendSubMenuItem:function(label,disabled)
1651 {var item=new WebInspector.ContextSubMenuItem(this._contextMenu,label,disabled);this._pushItem(item);return item;},appendCheckboxItem:function(label,handler,checked,disabled)
1652 {var item=new WebInspector.ContextMenuItem(this._contextMenu,"checkbox",label,disabled,checked);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;},appendSeparator:function()
1653 {if(this._items.length)
1654 this._pendingSeparator=true;},_pushItem:function(item)
1655 {if(this._pendingSeparator){this._items.push(new WebInspector.ContextMenuItem(this._contextMenu,"separator"));delete this._pendingSeparator;}
1656 this._items.push(item);},isEmpty:function()
1657 {return!this._items.length;},_buildDescriptor:function()
1658 {var result={type:"subMenu",label:this._label,enabled:!this._disabled,subItems:[]};for(var i=0;i<this._items.length;++i)
1659 result.subItems.push(this._items[i]._buildDescriptor());return result;},__proto__:WebInspector.ContextMenuItem.prototype}
1660 WebInspector.ContextMenu=function(event){WebInspector.ContextSubMenuItem.call(this,this,"");this._event=event;this._handlers={};this._id=0;}
1661 WebInspector.ContextMenu.setUseSoftMenu=function(useSoftMenu)
1662 {WebInspector.ContextMenu._useSoftMenu=useSoftMenu;}
1663 WebInspector.ContextMenu.prototype={nextId:function()
1664 {return this._id++;},show:function()
1665 {var menuObject=this._buildDescriptor();if(menuObject.length){WebInspector._contextMenu=this;if(WebInspector.ContextMenu._useSoftMenu){var softMenu=new WebInspector.SoftContextMenu(menuObject);softMenu.show(this._event);}else{InspectorFrontendHost.showContextMenu(this._event,menuObject);}
1666 this._event.consume();}},_setHandler:function(id,handler)
1667 {if(handler)
1668 this._handlers[id]=handler;},_buildDescriptor:function()
1669 {var result=[];for(var i=0;i<this._items.length;++i)
1670 result.push(this._items[i]._buildDescriptor());return result;},_itemSelected:function(id)
1671 {if(this._handlers[id])
1672 this._handlers[id].call(this);},appendApplicableItems:function(target)
1673 {WebInspector.moduleManager.extensions(WebInspector.ContextMenu.Provider).forEach(processProviders.bind(this));function processProviders(extension)
1674 {if(!extension.isApplicable(target))
1675 return;var provider=(extension.instance());this.appendSeparator();provider.appendApplicableItems(this._event,this,target);this.appendSeparator();}},__proto__:WebInspector.ContextSubMenuItem.prototype}
1676 WebInspector.ContextMenu.Provider=function(){}
1677 WebInspector.ContextMenu.Provider.prototype={appendApplicableItems:function(event,contextMenu,target){}}
1678 WebInspector.contextMenuItemSelected=function(id)
1679 {if(WebInspector._contextMenu)
1680 WebInspector._contextMenu._itemSelected(id);}
1681 WebInspector.contextMenuCleared=function()
1682 {}
1683 WebInspector.SoftContextMenu=function(items,parentMenu)
1684 {this._items=items;this._parentMenu=parentMenu;}
1685 WebInspector.SoftContextMenu.prototype={show:function(event)
1686 {this._x=event.x;this._y=event.y;this._time=new Date().getTime();var absoluteX=event.pageX;var absoluteY=event.pageY;var targetElement=event.target;while(targetElement&&window!==targetElement.ownerDocument.defaultView){var frameElement=targetElement.ownerDocument.defaultView.frameElement;absoluteY+=frameElement.totalOffsetTop();absoluteX+=frameElement.totalOffsetLeft();targetElement=frameElement;}
1687 var targetRect;this._contextMenuElement=document.createElement("div");this._contextMenuElement.className="soft-context-menu";this._contextMenuElement.tabIndex=0;this._contextMenuElement.style.top=absoluteY+"px";this._contextMenuElement.style.left=absoluteX+"px";this._contextMenuElement.addEventListener("mouseup",consumeEvent,false);this._contextMenuElement.addEventListener("keydown",this._menuKeyDown.bind(this),false);for(var i=0;i<this._items.length;++i)
1688 this._contextMenuElement.appendChild(this._createMenuItem(this._items[i]));if(!this._parentMenu){this._glassPaneElement=document.createElement("div");this._glassPaneElement.className="soft-context-menu-glass-pane";this._glassPaneElement.tabIndex=0;this._glassPaneElement.addEventListener("mouseup",this._glassPaneMouseUp.bind(this),false);this._glassPaneElement.appendChild(this._contextMenuElement);document.body.appendChild(this._glassPaneElement);this._focus();}else
1689 this._parentMenu._parentGlassPaneElement().appendChild(this._contextMenuElement);if(document.body.offsetWidth<this._contextMenuElement.offsetLeft+this._contextMenuElement.offsetWidth)
1690 this._contextMenuElement.style.left=(absoluteX-this._contextMenuElement.offsetWidth)+"px";if(document.body.offsetHeight<this._contextMenuElement.offsetTop+this._contextMenuElement.offsetHeight)
1691 this._contextMenuElement.style.top=(document.body.offsetHeight-this._contextMenuElement.offsetHeight)+"px";event.consume(true);},_parentGlassPaneElement:function()
1692 {if(this._glassPaneElement)
1693 return this._glassPaneElement;if(this._parentMenu)
1694 return this._parentMenu._parentGlassPaneElement();return null;},_createMenuItem:function(item)
1695 {if(item.type==="separator")
1696 return this._createSeparator();if(item.type==="subMenu")
1697 return this._createSubMenu(item);var menuItemElement=document.createElement("div");menuItemElement.className="soft-context-menu-item";var checkMarkElement=document.createElement("span");checkMarkElement.textContent="\u2713 ";checkMarkElement.className="soft-context-menu-item-checkmark";if(!item.checked)
1698 checkMarkElement.style.opacity="0";menuItemElement.appendChild(checkMarkElement);menuItemElement.appendChild(document.createTextNode(item.label));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);menuItemElement._actionId=item.id;return menuItemElement;},_createSubMenu:function(item)
1699 {var menuItemElement=document.createElement("div");menuItemElement.className="soft-context-menu-item";menuItemElement._subItems=item.subItems;var checkMarkElement=document.createElement("span");checkMarkElement.textContent="\u2713 ";checkMarkElement.className="soft-context-menu-item-checkmark";checkMarkElement.style.opacity="0";menuItemElement.appendChild(checkMarkElement);var subMenuArrowElement=document.createElement("span");subMenuArrowElement.textContent="\u25B6";subMenuArrowElement.className="soft-context-menu-item-submenu-arrow";menuItemElement.appendChild(document.createTextNode(item.label));menuItemElement.appendChild(subMenuArrowElement);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:function()
1700 {var separatorElement=document.createElement("div");separatorElement.className="soft-context-menu-separator";separatorElement._isSeparator=true;separatorElement.addEventListener("mouseover",this._hideSubMenu.bind(this),false);separatorElement.createChild("div","separator-line");return separatorElement;},_menuItemMouseDown:function(event)
1701 {event.consume(true);},_menuItemMouseUp:function(event)
1702 {this._triggerAction(event.target,event);event.consume();},_focus:function()
1703 {this._contextMenuElement.focus();},_triggerAction:function(menuItemElement,event)
1704 {if(!menuItemElement._subItems){this._discardMenu(true,event);if(typeof menuItemElement._actionId!=="undefined"){WebInspector.contextMenuItemSelected(menuItemElement._actionId);delete menuItemElement._actionId;}
1705 return;}
1706 this._showSubMenu(menuItemElement,event);event.consume();},_showSubMenu:function(menuItemElement,event)
1707 {if(menuItemElement._subMenuTimer){clearTimeout(menuItemElement._subMenuTimer);delete menuItemElement._subMenuTimer;}
1708 if(this._subMenu)
1709 return;this._subMenu=new WebInspector.SoftContextMenu(menuItemElement._subItems,this);this._subMenu.show(this._buildMouseEventForSubMenu(menuItemElement));},_buildMouseEventForSubMenu:function(subMenuItemElement)
1710 {var subMenuOffset={x:subMenuItemElement.offsetWidth-3,y:subMenuItemElement.offsetTop-1};var targetX=this._x+subMenuOffset.x;var targetY=this._y+subMenuOffset.y;var targetPageX=parseInt(this._contextMenuElement.style.left,10)+subMenuOffset.x;var targetPageY=parseInt(this._contextMenuElement.style.top,10)+subMenuOffset.y;return{x:targetX,y:targetY,pageX:targetPageX,pageY:targetPageY,consume:function(){}};},_hideSubMenu:function()
1711 {if(!this._subMenu)
1712 return;this._subMenu._discardSubMenus();this._focus();},_menuItemMouseOver:function(event)
1713 {this._highlightMenuItem(event.target);},_menuItemMouseOut:function(event)
1714 {if(!this._subMenu||!event.relatedTarget){this._highlightMenuItem(null);return;}
1715 var relatedTarget=event.relatedTarget;if(this._contextMenuElement.isSelfOrAncestor(relatedTarget)||relatedTarget.classList.contains("soft-context-menu-glass-pane"))
1716 this._highlightMenuItem(null);},_highlightMenuItem:function(menuItemElement)
1717 {if(this._highlightedMenuItemElement===menuItemElement)
1718 return;this._hideSubMenu();if(this._highlightedMenuItemElement){this._highlightedMenuItemElement.classList.remove("soft-context-menu-item-mouse-over");if(this._highlightedMenuItemElement._subItems&&this._highlightedMenuItemElement._subMenuTimer){clearTimeout(this._highlightedMenuItemElement._subMenuTimer);delete this._highlightedMenuItemElement._subMenuTimer;}}
1719 this._highlightedMenuItemElement=menuItemElement;if(this._highlightedMenuItemElement){this._highlightedMenuItemElement.classList.add("soft-context-menu-item-mouse-over");this._contextMenuElement.focus();if(this._highlightedMenuItemElement._subItems&&!this._highlightedMenuItemElement._subMenuTimer)
1720 this._highlightedMenuItemElement._subMenuTimer=setTimeout(this._showSubMenu.bind(this,this._highlightedMenuItemElement,this._buildMouseEventForSubMenu(this._highlightedMenuItemElement)),150);}},_highlightPrevious:function()
1721 {var menuItemElement=this._highlightedMenuItemElement?this._highlightedMenuItemElement.previousSibling:this._contextMenuElement.lastChild;while(menuItemElement&&menuItemElement._isSeparator)
1722 menuItemElement=menuItemElement.previousSibling;if(menuItemElement)
1723 this._highlightMenuItem(menuItemElement);},_highlightNext:function()
1724 {var menuItemElement=this._highlightedMenuItemElement?this._highlightedMenuItemElement.nextSibling:this._contextMenuElement.firstChild;while(menuItemElement&&menuItemElement._isSeparator)
1725 menuItemElement=menuItemElement.nextSibling;if(menuItemElement)
1726 this._highlightMenuItem(menuItemElement);},_menuKeyDown:function(event)
1727 {switch(event.keyIdentifier){case"Up":this._highlightPrevious();break;case"Down":this._highlightNext();break;case"Left":if(this._parentMenu){this._highlightMenuItem(null);this._parentMenu._focus();}
1728 break;case"Right":if(!this._highlightedMenuItemElement)
1729 break;if(this._highlightedMenuItemElement._subItems){this._showSubMenu(this._highlightedMenuItemElement,this._buildMouseEventForSubMenu(this._highlightedMenuItemElement));this._subMenu._focus();this._subMenu._highlightNext();}
1730 break;case"U+001B":this._discardMenu(true,event);break;case"Enter":if(!isEnterKey(event))
1731 break;case"U+0020":if(this._highlightedMenuItemElement)
1732 this._triggerAction(this._highlightedMenuItemElement,event);break;}
1733 event.consume(true);},_glassPaneMouseUp:function(event)
1734 {if(event.x===this._x&&event.y===this._y&&new Date().getTime()-this._time<300)
1735 return;this._discardMenu(true,event);event.consume();},_discardMenu:function(closeParentMenus,event)
1736 {if(this._subMenu&&!closeParentMenus)
1737 return;if(this._glassPaneElement){var glassPane=this._glassPaneElement;delete this._glassPaneElement;document.body.removeChild(glassPane);if(this._parentMenu){delete this._parentMenu._subMenu;if(closeParentMenus)
1738 this._parentMenu._discardMenu(closeParentMenus,event);}
1739 if(event)
1740 event.consume(true);}else if(this._parentMenu&&this._contextMenuElement.parentElement){this._discardSubMenus();if(closeParentMenus)
1741 this._parentMenu._discardMenu(closeParentMenus,event);if(event)
1742 event.consume(true);}},_discardSubMenus:function()
1743 {if(this._subMenu)
1744 this._subMenu._discardSubMenus();this._contextMenuElement.remove();if(this._parentMenu)
1745 delete this._parentMenu._subMenu;}}
1746 if(!InspectorFrontendHost.showContextMenu){InspectorFrontendHost.showContextMenu=function(event,items)
1747 {new WebInspector.SoftContextMenu(items).show(event);}}
1748 WebInspector.KeyboardShortcut=function()
1749 {}
1750 WebInspector.KeyboardShortcut.Modifiers={None:0,Shift:1,Ctrl:2,Alt:4,Meta:8,get CtrlOrMeta()
1751 {return WebInspector.isMac()?this.Meta:this.Ctrl;}};WebInspector.KeyboardShortcut.Key;WebInspector.KeyboardShortcut.Keys={Backspace:{code:8,name:"\u21a4"},Tab:{code:9,name:{mac:"\u21e5",other:"Tab"}},Enter:{code:13,name:{mac:"\u21a9",other:"Enter"}},Ctrl:{code:17,name:"Ctrl"},Esc:{code:27,name:{mac:"\u238b",other:"Esc"}},Space:{code:32,name:"Space"},PageUp:{code:33,name:{mac:"\u21de",other:"PageUp"}},PageDown:{code:34,name:{mac:"\u21df",other:"PageDown"}},End:{code:35,name:{mac:"\u2197",other:"End"}},Home:{code:36,name:{mac:"\u2196",other:"Home"}},Left:{code:37,name:"\u2190"},Up:{code:38,name:"\u2191"},Right:{code:39,name:"\u2192"},Down:{code:40,name:"\u2193"},Delete:{code:46,name:"Del"},Zero:{code:48,name:"0"},H:{code:72,name:"H"},Meta:{code:91,name:"Meta"},F1:{code:112,name:"F1"},F2:{code:113,name:"F2"},F3:{code:114,name:"F3"},F4:{code:115,name:"F4"},F5:{code:116,name:"F5"},F6:{code:117,name:"F6"},F7:{code:118,name:"F7"},F8:{code:119,name:"F8"},F9:{code:120,name:"F9"},F10:{code:121,name:"F10"},F11:{code:122,name:"F11"},F12:{code:123,name:"F12"},Semicolon:{code:186,name:";"},Plus:{code:187,name:"+"},Comma:{code:188,name:","},Minus:{code:189,name:"-"},Period:{code:190,name:"."},Slash:{code:191,name:"/"},QuestionMark:{code:191,name:"?"},Apostrophe:{code:192,name:"`"},Tilde:{code:192,name:"Tilde"},Backslash:{code:220,name:"\\"},SingleQuote:{code:222,name:"\'"},get CtrlOrMeta()
1752 {return WebInspector.isMac()?this.Meta:this.Ctrl;},};WebInspector.KeyboardShortcut.makeKey=function(keyCode,modifiers)
1753 {if(typeof keyCode==="string")
1754 keyCode=keyCode.charCodeAt(0)-32;modifiers=modifiers||WebInspector.KeyboardShortcut.Modifiers.None;return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode,modifiers);}
1755 WebInspector.KeyboardShortcut.makeKeyFromEvent=function(keyboardEvent)
1756 {var modifiers=WebInspector.KeyboardShortcut.Modifiers.None;if(keyboardEvent.shiftKey)
1757 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Shift;if(keyboardEvent.ctrlKey)
1758 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Ctrl;if(keyboardEvent.altKey)
1759 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Alt;if(keyboardEvent.metaKey)
1760 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Meta;return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyboardEvent.keyCode,modifiers);}
1761 WebInspector.KeyboardShortcut.eventHasCtrlOrMeta=function(event)
1762 {return WebInspector.isMac()?event.metaKey&&!event.ctrlKey:event.ctrlKey&&!event.metaKey;}
1763 WebInspector.KeyboardShortcut.hasNoModifiers=function(event)
1764 {return!event.ctrlKey&&!event.shiftKey&&!event.altKey&&!event.metaKey;}
1765 WebInspector.KeyboardShortcut.Descriptor;WebInspector.KeyboardShortcut.makeDescriptor=function(key,modifiers)
1766 {return{key:WebInspector.KeyboardShortcut.makeKey(typeof key==="string"?key:key.code,modifiers),name:WebInspector.KeyboardShortcut.shortcutToString(key,modifiers)};}
1767 WebInspector.KeyboardShortcut.shortcutToString=function(key,modifiers)
1768 {return WebInspector.KeyboardShortcut._modifiersToString(modifiers)+WebInspector.KeyboardShortcut._keyName(key);}
1769 WebInspector.KeyboardShortcut._keyName=function(key)
1770 {if(typeof key==="string")
1771 return key.toUpperCase();if(typeof key.name==="string")
1772 return key.name;return key.name[WebInspector.platform()]||key.name.other||'';}
1773 WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers=function(keyCode,modifiers)
1774 {return(keyCode&255)|(modifiers<<8);};WebInspector.KeyboardShortcut._modifiersToString=function(modifiers)
1775 {const cmdKey="\u2318";const optKey="\u2325";const shiftKey="\u21e7";const ctrlKey="\u2303";var isMac=WebInspector.isMac();var res="";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Ctrl)
1776 res+=isMac?ctrlKey:"Ctrl + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Alt)
1777 res+=isMac?optKey:"Alt + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Shift)
1778 res+=isMac?shiftKey:"Shift + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Meta)
1779 res+=isMac?cmdKey:"Win + ";return res;};WebInspector.KeyboardShortcut.SelectAll=WebInspector.KeyboardShortcut.makeKey("a",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);WebInspector.SuggestBoxDelegate=function()
1780 {}
1781 WebInspector.SuggestBoxDelegate.prototype={applySuggestion:function(suggestion,isIntermediateSuggestion){},acceptSuggestion:function(){},}
1782 WebInspector.SuggestBox=function(suggestBoxDelegate,anchorElement,className,maxItemsHeight)
1783 {this._suggestBoxDelegate=suggestBoxDelegate;this._anchorElement=anchorElement;this._length=0;this._selectedIndex=-1;this._selectedElement=null;this._maxItemsHeight=maxItemsHeight;this._boundOnScroll=this._onScrollOrResize.bind(this,true);this._boundOnResize=this._onScrollOrResize.bind(this,false);window.addEventListener("scroll",this._boundOnScroll,true);window.addEventListener("resize",this._boundOnResize,true);this._bodyElement=anchorElement.ownerDocument.body;this._element=anchorElement.ownerDocument.createElement("div");this._element.className="suggest-box "+(className||"");this._element.addEventListener("mousedown",this._onBoxMouseDown.bind(this),true);this.containerElement=this._element.createChild("div","container");this.contentElement=this.containerElement.createChild("div","content");}
1784 WebInspector.SuggestBox.prototype={visible:function()
1785 {return!!this._element.parentElement;},_onScrollOrResize:function(isScroll,event)
1786 {if(isScroll&&this._element.isAncestor(event.target)||!this.visible())
1787 return;this._updateBoxPosition(this._anchorBox);},setPosition:function(anchorBox)
1788 {this._updateBoxPosition(anchorBox);},_updateBoxPosition:function(anchorBox)
1789 {this._anchorBox=anchorBox;anchorBox=anchorBox||this._anchorElement.boxInWindow(window);var container=WebInspector.inspectorView.devtoolsElement();anchorBox=anchorBox.relativeToElement(container);var totalWidth=container.offsetWidth;var totalHeight=container.offsetHeight;this.contentElement.style.display="inline-block";document.body.appendChild(this.contentElement);this.contentElement.positionAt(0,0);var contentWidth=this.contentElement.offsetWidth;var contentHeight=this.contentElement.offsetHeight;this.contentElement.style.display="block";this.containerElement.appendChild(this.contentElement);const spacer=6;const suggestBoxPaddingX=21;const suggestBoxPaddingY=2;var maxWidth=totalWidth-anchorBox.x-spacer;var width=Math.min(contentWidth,maxWidth-suggestBoxPaddingX)+suggestBoxPaddingX;var paddedWidth=contentWidth+suggestBoxPaddingX;var boxX=anchorBox.x;if(width<paddedWidth){maxWidth=totalWidth-spacer;width=Math.min(contentWidth,maxWidth-suggestBoxPaddingX)+suggestBoxPaddingX;boxX=totalWidth-width;}
1790 var boxY;var aboveHeight=anchorBox.y;var underHeight=totalHeight-anchorBox.y-anchorBox.height;var maxHeight=this._maxItemsHeight?contentHeight*this._maxItemsHeight/this._length:Math.max(underHeight,aboveHeight)-spacer;var height=Math.min(contentHeight,maxHeight-suggestBoxPaddingY)+suggestBoxPaddingY;if(underHeight>=aboveHeight){boxY=anchorBox.y+anchorBox.height;this._element.classList.remove("above-anchor");this._element.classList.add("under-anchor");}else{boxY=anchorBox.y-height;this._element.classList.remove("under-anchor");this._element.classList.add("above-anchor");}
1791 this._element.positionAt(boxX,boxY,container);this._element.style.width=width+"px";this._element.style.height=height+"px";},_onBoxMouseDown:function(event)
1792 {event.preventDefault();},hide:function()
1793 {if(!this.visible())
1794 return;this._element.remove();delete this._selectedElement;this._selectedIndex=-1;},removeFromElement:function()
1795 {window.removeEventListener("scroll",this._boundOnScroll,true);window.removeEventListener("resize",this._boundOnResize,true);this.hide();},_applySuggestion:function(text,isIntermediateSuggestion)
1796 {if(!this.visible()||!(text||this._selectedElement))
1797 return false;var suggestion=text||this._selectedElement.textContent;if(!suggestion)
1798 return false;this._suggestBoxDelegate.applySuggestion(suggestion,isIntermediateSuggestion);return true;},acceptSuggestion:function(text)
1799 {var result=this._applySuggestion(text,false);this.hide();if(!result)
1800 return false;this._suggestBoxDelegate.acceptSuggestion();return true;},_selectClosest:function(shift,isCircular)
1801 {if(!this._length)
1802 return false;if(this._selectedIndex===-1&&shift<0)
1803 shift+=1;var index=this._selectedIndex+shift;if(isCircular)
1804 index=(this._length+index)%this._length;else
1805 index=Number.constrain(index,0,this._length-1);this._selectItem(index);this._applySuggestion(undefined,true);return true;},_onItemMouseDown:function(text,event)
1806 {this.acceptSuggestion(text);event.consume(true);},_createItemElement:function(prefix,text)
1807 {var element=document.createElement("div");element.className="suggest-box-content-item source-code";element.tabIndex=-1;if(prefix&&prefix.length&&!text.indexOf(prefix)){var prefixElement=element.createChild("span","prefix");prefixElement.textContent=prefix;var suffixElement=element.createChild("span","suffix");suffixElement.textContent=text.substring(prefix.length);}else{var suffixElement=element.createChild("span","suffix");suffixElement.textContent=text;}
1808 element.addEventListener("mousedown",this._onItemMouseDown.bind(this,text),false);return element;},_updateItems:function(items,selectedIndex,userEnteredText)
1809 {this._length=items.length;this.contentElement.removeChildren();for(var i=0;i<items.length;++i){var item=items[i];var currentItemElement=this._createItemElement(userEnteredText,item);this.contentElement.appendChild(currentItemElement);}
1810 this._selectedElement=null;if(typeof selectedIndex==="number")
1811 this._selectItem(selectedIndex);},_selectItem:function(index)
1812 {if(this._selectedElement)
1813 this._selectedElement.classList.remove("selected");this._selectedIndex=index;if(index<0)
1814 return;this._selectedElement=this.contentElement.children[index];this._selectedElement.classList.add("selected");this._selectedElement.scrollIntoViewIfNeeded(false);},_canShowBox:function(completions,canShowForSingleItem,userEnteredText)
1815 {if(!completions||!completions.length)
1816 return false;if(completions.length>1)
1817 return true;return canShowForSingleItem&&completions[0]!==userEnteredText;},_rememberRowCountPerViewport:function()
1818 {if(!this.contentElement.firstChild)
1819 return;this._rowCountPerViewport=Math.floor(this.containerElement.offsetHeight/this.contentElement.firstChild.offsetHeight);},updateSuggestions:function(anchorBox,completions,selectedIndex,canShowForSingleItem,userEnteredText)
1820 {if(this._canShowBox(completions,canShowForSingleItem,userEnteredText)){this._updateItems(completions,selectedIndex,userEnteredText);this._updateBoxPosition(anchorBox);if(!this.visible())
1821 this._bodyElement.appendChild(this._element);this._rememberRowCountPerViewport();}else
1822 this.hide();},keyPressed:function(event)
1823 {switch(event.keyIdentifier){case"Up":return this.upKeyPressed();case"Down":return this.downKeyPressed();case"PageUp":return this.pageUpKeyPressed();case"PageDown":return this.pageDownKeyPressed();case"Enter":return this.enterKeyPressed();}
1824 return false;},upKeyPressed:function()
1825 {return this._selectClosest(-1,true);},downKeyPressed:function()
1826 {return this._selectClosest(1,true);},pageUpKeyPressed:function()
1827 {return this._selectClosest(-this._rowCountPerViewport,false);},pageDownKeyPressed:function()
1828 {return this._selectClosest(this._rowCountPerViewport,false);},enterKeyPressed:function()
1829 {var hasSelectedItem=!!this._selectedElement;this.acceptSuggestion();return hasSelectedItem;}}
1830 WebInspector.TextPrompt=function(completions,stopCharacters)
1831 {this._proxyElement;this._proxyElementDisplay="inline-block";this._loadCompletions=completions;this._completionStopCharacters=stopCharacters||" =:[({;,!+-*/&|^<>.";}
1832 WebInspector.TextPrompt.Events={ItemApplied:"text-prompt-item-applied",ItemAccepted:"text-prompt-item-accepted"};WebInspector.TextPrompt.prototype={get proxyElement()
1833 {return this._proxyElement;},setSuggestBoxEnabled:function(className)
1834 {this._suggestBoxClassName=className;},renderAsBlock:function()
1835 {this._proxyElementDisplay="block";},attach:function(element)
1836 {return this._attachInternal(element);},attachAndStartEditing:function(element,blurListener)
1837 {this._attachInternal(element);this._startEditing(blurListener);return this.proxyElement;},_attachInternal:function(element)
1838 {if(this.proxyElement)
1839 throw"Cannot attach an attached TextPrompt";this._element=element;this._boundOnKeyDown=this.onKeyDown.bind(this);this._boundOnMouseWheel=this.onMouseWheel.bind(this);this._boundSelectStart=this._selectStart.bind(this);this._proxyElement=element.ownerDocument.createElement("span");this._proxyElement.style.display=this._proxyElementDisplay;element.parentElement.insertBefore(this.proxyElement,element);this.proxyElement.appendChild(element);this._element.classList.add("text-prompt");this._element.addEventListener("keydown",this._boundOnKeyDown,false);this._element.addEventListener("mousewheel",this._boundOnMouseWheel,false);this._element.addEventListener("selectstart",this._boundSelectStart,false);if(typeof this._suggestBoxClassName==="string")
1840 this._suggestBox=new WebInspector.SuggestBox(this,this._element,this._suggestBoxClassName);return this.proxyElement;},detach:function()
1841 {this._removeFromElement();this.proxyElement.parentElement.insertBefore(this._element,this.proxyElement);this.proxyElement.remove();delete this._proxyElement;this._element.classList.remove("text-prompt");this._element.removeEventListener("keydown",this._boundOnKeyDown,false);this._element.removeEventListener("mousewheel",this._boundOnMouseWheel,false);this._element.removeEventListener("selectstart",this._boundSelectStart,false);WebInspector.restoreFocusFromElement(this._element);},get text()
1842 {return this._element.textContent;},set text(x)
1843 {this._removeSuggestionAids();if(!x){this._element.removeChildren();this._element.appendChild(document.createElement("br"));}else
1844 this._element.textContent=x;this.moveCaretToEndOfPrompt();this._element.scrollIntoView();},_removeFromElement:function()
1845 {this.clearAutoComplete(true);this._element.removeEventListener("keydown",this._boundOnKeyDown,false);this._element.removeEventListener("selectstart",this._boundSelectStart,false);if(this._isEditing)
1846 this._stopEditing();if(this._suggestBox)
1847 this._suggestBox.removeFromElement();},_startEditing:function(blurListener)
1848 {this._isEditing=true;this._element.classList.add("editing");if(blurListener){this._blurListener=blurListener;this._element.addEventListener("blur",this._blurListener,false);}
1849 this._oldTabIndex=this._element.tabIndex;if(this._element.tabIndex<0)
1850 this._element.tabIndex=0;WebInspector.setCurrentFocusElement(this._element);if(!this.text)
1851 this._updateAutoComplete();},_stopEditing:function()
1852 {this._element.tabIndex=this._oldTabIndex;if(this._blurListener)
1853 this._element.removeEventListener("blur",this._blurListener,false);this._element.classList.remove("editing");delete this._isEditing;},_removeSuggestionAids:function()
1854 {this.clearAutoComplete();this.hideSuggestBox();},_selectStart:function()
1855 {if(this._selectionTimeout)
1856 clearTimeout(this._selectionTimeout);this._removeSuggestionAids();function moveBackIfOutside()
1857 {delete this._selectionTimeout;if(!this.isCaretInsidePrompt()&&window.getSelection().isCollapsed){this.moveCaretToEndOfPrompt();this.autoCompleteSoon();}}
1858 this._selectionTimeout=setTimeout(moveBackIfOutside.bind(this),100);},defaultKeyHandler:function(event,force)
1859 {this._updateAutoComplete(force);return false;},_updateAutoComplete:function(force)
1860 {this.clearAutoComplete();this.autoCompleteSoon(force);},onMouseWheel:function(event)
1861 {},onKeyDown:function(event)
1862 {var handled=false;var invokeDefault=true;switch(event.keyIdentifier){case"U+0009":handled=this.tabKeyPressed(event);break;case"Left":case"Home":this._removeSuggestionAids();invokeDefault=false;break;case"Right":case"End":if(this.isCaretAtEndOfPrompt())
1863 handled=this.acceptAutoComplete();else
1864 this._removeSuggestionAids();invokeDefault=false;break;case"U+001B":if(this.isSuggestBoxVisible()){this._removeSuggestionAids();handled=true;}
1865 break;case"U+0020":if(event.ctrlKey&&!event.metaKey&&!event.altKey&&!event.shiftKey){this.defaultKeyHandler(event,true);handled=true;}
1866 break;case"Alt":case"Meta":case"Shift":case"Control":invokeDefault=false;break;}
1867 if(!handled&&this.isSuggestBoxVisible())
1868 handled=this._suggestBox.keyPressed(event);if(!handled&&invokeDefault)
1869 handled=this.defaultKeyHandler(event);if(handled)
1870 event.consume(true);return handled;},acceptAutoComplete:function()
1871 {var result=false;if(this.isSuggestBoxVisible())
1872 result=this._suggestBox.acceptSuggestion();if(!result)
1873 result=this._acceptSuggestionInternal();return result;},clearAutoComplete:function(includeTimeout)
1874 {if(includeTimeout&&this._completeTimeout){clearTimeout(this._completeTimeout);delete this._completeTimeout;}
1875 delete this._waitingForCompletions;if(!this.autoCompleteElement)
1876 return;this.autoCompleteElement.remove();delete this.autoCompleteElement;if(!this._userEnteredRange||!this._userEnteredText)
1877 return;this._userEnteredRange.deleteContents();this._element.normalize();var userTextNode=document.createTextNode(this._userEnteredText);this._userEnteredRange.insertNode(userTextNode);var selectionRange=document.createRange();selectionRange.setStart(userTextNode,this._userEnteredText.length);selectionRange.setEnd(userTextNode,this._userEnteredText.length);var selection=window.getSelection();selection.removeAllRanges();selection.addRange(selectionRange);delete this._userEnteredRange;delete this._userEnteredText;},autoCompleteSoon:function(force)
1878 {var immediately=this.isSuggestBoxVisible()||force;if(!this._completeTimeout)
1879 this._completeTimeout=setTimeout(this.complete.bind(this,force),immediately?0:250);},complete:function(force,reverse)
1880 {this.clearAutoComplete(true);var selection=window.getSelection();if(!selection.rangeCount)
1881 return;var selectionRange=selection.getRangeAt(0);var shouldExit;if(!force&&!this.isCaretAtEndOfPrompt()&&!this.isSuggestBoxVisible())
1882 shouldExit=true;else if(!selection.isCollapsed)
1883 shouldExit=true;else if(!force){var wordSuffixRange=selectionRange.startContainer.rangeOfWord(selectionRange.endOffset,this._completionStopCharacters,this._element,"forward");if(wordSuffixRange.toString().length)
1884 shouldExit=true;}
1885 if(shouldExit){this.hideSuggestBox();return;}
1886 var wordPrefixRange=selectionRange.startContainer.rangeOfWord(selectionRange.startOffset,this._completionStopCharacters,this._element,"backward");this._waitingForCompletions=true;this._loadCompletions(this.proxyElement,wordPrefixRange,force,this._completionsReady.bind(this,selection,wordPrefixRange,!!reverse));},disableDefaultSuggestionForEmptyInput:function()
1887 {this._disableDefaultSuggestionForEmptyInput=true;},_boxForAnchorAtStart:function(selection,textRange)
1888 {var rangeCopy=selection.getRangeAt(0).cloneRange();var anchorElement=document.createElement("span");anchorElement.textContent="\u200B";textRange.insertNode(anchorElement);var box=anchorElement.boxInWindow(window);anchorElement.remove();selection.removeAllRanges();selection.addRange(rangeCopy);return box;},_buildCommonPrefix:function(completions,wordPrefixLength)
1889 {var commonPrefix=completions[0];for(var i=0;i<completions.length;++i){var completion=completions[i];var lastIndex=Math.min(commonPrefix.length,completion.length);for(var j=wordPrefixLength;j<lastIndex;++j){if(commonPrefix[j]!==completion[j]){commonPrefix=commonPrefix.substr(0,j);break;}}}
1890 return commonPrefix;},_completionsReady:function(selection,originalWordPrefixRange,reverse,completions,selectedIndex)
1891 {if(!this._waitingForCompletions||!completions.length){this.hideSuggestBox();return;}
1892 delete this._waitingForCompletions;var selectionRange=selection.getRangeAt(0);var fullWordRange=document.createRange();fullWordRange.setStart(originalWordPrefixRange.startContainer,originalWordPrefixRange.startOffset);fullWordRange.setEnd(selectionRange.endContainer,selectionRange.endOffset);if(originalWordPrefixRange.toString()+selectionRange.toString()!==fullWordRange.toString())
1893 return;selectedIndex=(this._disableDefaultSuggestionForEmptyInput&&!this.text)?-1:(selectedIndex||0);this._userEnteredRange=fullWordRange;this._userEnteredText=fullWordRange.toString();if(this._suggestBox)
1894 this._suggestBox.updateSuggestions(this._boxForAnchorAtStart(selection,fullWordRange),completions,selectedIndex,!this.isCaretAtEndOfPrompt(),this._userEnteredText);if(selectedIndex===-1)
1895 return;var wordPrefixLength=originalWordPrefixRange.toString().length;this._commonPrefix=this._buildCommonPrefix(completions,wordPrefixLength);if(this.isCaretAtEndOfPrompt()){this._userEnteredRange.deleteContents();this._element.normalize();var finalSelectionRange=document.createRange();var completionText=completions[selectedIndex];var prefixText=completionText.substring(0,wordPrefixLength);var suffixText=completionText.substring(wordPrefixLength);var prefixTextNode=document.createTextNode(prefixText);fullWordRange.insertNode(prefixTextNode);this.autoCompleteElement=document.createElement("span");this.autoCompleteElement.className="auto-complete-text";this.autoCompleteElement.textContent=suffixText;prefixTextNode.parentNode.insertBefore(this.autoCompleteElement,prefixTextNode.nextSibling);finalSelectionRange.setStart(prefixTextNode,wordPrefixLength);finalSelectionRange.setEnd(prefixTextNode,wordPrefixLength);selection.removeAllRanges();selection.addRange(finalSelectionRange);this.dispatchEventToListeners(WebInspector.TextPrompt.Events.ItemApplied);}},_completeCommonPrefix:function()
1896 {if(!this.autoCompleteElement||!this._commonPrefix||!this._userEnteredText||!this._commonPrefix.startsWith(this._userEnteredText))
1897 return;if(!this.isSuggestBoxVisible()){this.acceptAutoComplete();return;}
1898 this.autoCompleteElement.textContent=this._commonPrefix.substring(this._userEnteredText.length);this._acceptSuggestionInternal(true);},applySuggestion:function(completionText,isIntermediateSuggestion)
1899 {this._applySuggestion(completionText,isIntermediateSuggestion);},_applySuggestion:function(completionText,isIntermediateSuggestion,originalPrefixRange)
1900 {var wordPrefixLength;if(originalPrefixRange)
1901 wordPrefixLength=originalPrefixRange.toString().length;else
1902 wordPrefixLength=this._userEnteredText?this._userEnteredText.length:0;this._userEnteredRange.deleteContents();this._element.normalize();var finalSelectionRange=document.createRange();var completionTextNode=document.createTextNode(completionText);this._userEnteredRange.insertNode(completionTextNode);if(this.autoCompleteElement){this.autoCompleteElement.remove();delete this.autoCompleteElement;}
1903 if(isIntermediateSuggestion)
1904 finalSelectionRange.setStart(completionTextNode,wordPrefixLength);else
1905 finalSelectionRange.setStart(completionTextNode,completionText.length);finalSelectionRange.setEnd(completionTextNode,completionText.length);var selection=window.getSelection();selection.removeAllRanges();selection.addRange(finalSelectionRange);if(isIntermediateSuggestion)
1906 this.dispatchEventToListeners(WebInspector.TextPrompt.Events.ItemApplied,{itemText:completionText});},acceptSuggestion:function()
1907 {this._acceptSuggestionInternal();},_acceptSuggestionInternal:function(prefixAccepted)
1908 {if(this._isAcceptingSuggestion)
1909 return false;if(!this.autoCompleteElement||!this.autoCompleteElement.parentNode)
1910 return false;var text=this.autoCompleteElement.textContent;var textNode=document.createTextNode(text);this.autoCompleteElement.parentNode.replaceChild(textNode,this.autoCompleteElement);delete this.autoCompleteElement;var finalSelectionRange=document.createRange();finalSelectionRange.setStart(textNode,text.length);finalSelectionRange.setEnd(textNode,text.length);var selection=window.getSelection();selection.removeAllRanges();selection.addRange(finalSelectionRange);if(!prefixAccepted){this.hideSuggestBox();this.dispatchEventToListeners(WebInspector.TextPrompt.Events.ItemAccepted);}else
1911 this.autoCompleteSoon(true);return true;},hideSuggestBox:function()
1912 {if(this.isSuggestBoxVisible())
1913 this._suggestBox.hide();},isSuggestBoxVisible:function()
1914 {return this._suggestBox&&this._suggestBox.visible();},isCaretInsidePrompt:function()
1915 {return this._element.isInsertionCaretInside();},isCaretAtEndOfPrompt:function()
1916 {var selection=window.getSelection();if(!selection.rangeCount||!selection.isCollapsed)
1917 return false;var selectionRange=selection.getRangeAt(0);var node=selectionRange.startContainer;if(!node.isSelfOrDescendant(this._element))
1918 return false;if(node.nodeType===Node.TEXT_NODE&&selectionRange.startOffset<node.nodeValue.length)
1919 return false;var foundNextText=false;while(node){if(node.nodeType===Node.TEXT_NODE&&node.nodeValue.length){if(foundNextText&&(!this.autoCompleteElement||!this.autoCompleteElement.isAncestor(node)))
1920 return false;foundNextText=true;}
1921 node=node.traverseNextNode(this._element);}
1922 return true;},isCaretOnFirstLine:function()
1923 {var selection=window.getSelection();var focusNode=selection.focusNode;if(!focusNode||focusNode.nodeType!==Node.TEXT_NODE||focusNode.parentNode!==this._element)
1924 return true;if(focusNode.textContent.substring(0,selection.focusOffset).indexOf("\n")!==-1)
1925 return false;focusNode=focusNode.previousSibling;while(focusNode){if(focusNode.nodeType!==Node.TEXT_NODE)
1926 return true;if(focusNode.textContent.indexOf("\n")!==-1)
1927 return false;focusNode=focusNode.previousSibling;}
1928 return true;},isCaretOnLastLine:function()
1929 {var selection=window.getSelection();var focusNode=selection.focusNode;if(!focusNode||focusNode.nodeType!==Node.TEXT_NODE||focusNode.parentNode!==this._element)
1930 return true;if(focusNode.textContent.substring(selection.focusOffset).indexOf("\n")!==-1)
1931 return false;focusNode=focusNode.nextSibling;while(focusNode){if(focusNode.nodeType!==Node.TEXT_NODE)
1932 return true;if(focusNode.textContent.indexOf("\n")!==-1)
1933 return false;focusNode=focusNode.nextSibling;}
1934 return true;},moveCaretToEndOfPrompt:function()
1935 {var selection=window.getSelection();var selectionRange=document.createRange();var offset=this._element.childNodes.length;selectionRange.setStart(this._element,offset);selectionRange.setEnd(this._element,offset);selection.removeAllRanges();selection.addRange(selectionRange);},tabKeyPressed:function(event)
1936 {this._completeCommonPrefix();return true;},__proto__:WebInspector.Object.prototype}
1937 WebInspector.TextPromptWithHistory=function(completions,stopCharacters)
1938 {WebInspector.TextPrompt.call(this,completions,stopCharacters);this._data=[];this._historyOffset=1;this._coalesceHistoryDupes=true;}
1939 WebInspector.TextPromptWithHistory.prototype={get historyData()
1940 {return this._data;},setCoalesceHistoryDupes:function(x)
1941 {this._coalesceHistoryDupes=x;},setHistoryData:function(data)
1942 {this._data=[].concat(data);this._historyOffset=1;},pushHistoryItem:function(text)
1943 {if(this._uncommittedIsTop){this._data.pop();delete this._uncommittedIsTop;}
1944 this._historyOffset=1;if(this._coalesceHistoryDupes&&text===this._currentHistoryItem())
1945 return;this._data.push(text);},_pushCurrentText:function()
1946 {if(this._uncommittedIsTop)
1947 this._data.pop();this._uncommittedIsTop=true;this.clearAutoComplete(true);this._data.push(this.text);},_previous:function()
1948 {if(this._historyOffset>this._data.length)
1949 return undefined;if(this._historyOffset===1)
1950 this._pushCurrentText();++this._historyOffset;return this._currentHistoryItem();},_next:function()
1951 {if(this._historyOffset===1)
1952 return undefined;--this._historyOffset;return this._currentHistoryItem();},_currentHistoryItem:function()
1953 {return this._data[this._data.length-this._historyOffset];},defaultKeyHandler:function(event,force)
1954 {var newText;var isPrevious;switch(event.keyIdentifier){case"Up":if(!this.isCaretOnFirstLine())
1955 break;newText=this._previous();isPrevious=true;break;case"Down":if(!this.isCaretOnLastLine())
1956 break;newText=this._next();break;case"U+0050":if(WebInspector.isMac()&&event.ctrlKey&&!event.metaKey&&!event.altKey&&!event.shiftKey){newText=this._previous();isPrevious=true;}
1957 break;case"U+004E":if(WebInspector.isMac()&&event.ctrlKey&&!event.metaKey&&!event.altKey&&!event.shiftKey)
1958 newText=this._next();break;}
1959 if(newText!==undefined){event.consume(true);this.text=newText;if(isPrevious){var firstNewlineIndex=this.text.indexOf("\n");if(firstNewlineIndex===-1)
1960 this.moveCaretToEndOfPrompt();else{var selection=window.getSelection();var selectionRange=document.createRange();selectionRange.setStart(this._element.firstChild,firstNewlineIndex);selectionRange.setEnd(this._element.firstChild,firstNewlineIndex);selection.removeAllRanges();selection.addRange(selectionRange);}}
1961 return true;}
1962 return WebInspector.TextPrompt.prototype.defaultKeyHandler.apply(this,arguments);},__proto__:WebInspector.TextPrompt.prototype}
1963 WebInspector.Popover=function(popoverHelper)
1964 {WebInspector.View.call(this);this.markAsRoot();this.element.className="popover custom-popup-vertical-scroll custom-popup-horizontal-scroll";this._popupArrowElement=document.createElement("div");this._popupArrowElement.className="arrow";this.element.appendChild(this._popupArrowElement);this._contentDiv=document.createElement("div");this._contentDiv.className="content";this.element.appendChild(this._contentDiv);this._popoverHelper=popoverHelper;}
1965 WebInspector.Popover.prototype={show:function(element,anchor,preferredWidth,preferredHeight,arrowDirection)
1966 {this._innerShow(null,element,anchor,preferredWidth,preferredHeight,arrowDirection);},showView:function(view,anchor,preferredWidth,preferredHeight)
1967 {this._innerShow(view,view.element,anchor,preferredWidth,preferredHeight);},_innerShow:function(view,contentElement,anchor,preferredWidth,preferredHeight,arrowDirection)
1968 {if(this._disposed)
1969 return;this.contentElement=contentElement;if(WebInspector.Popover._popover)
1970 WebInspector.Popover._popover.detach();WebInspector.Popover._popover=this;var preferredSize=view?view.measurePreferredSize():this.contentElement.measurePreferredSize();preferredWidth=preferredWidth||preferredSize.width;preferredHeight=preferredHeight||preferredSize.height;WebInspector.View.prototype.show.call(this,document.body);if(view)
1971 view.show(this._contentDiv);else
1972 this._contentDiv.appendChild(this.contentElement);this._positionElement(anchor,preferredWidth,preferredHeight,arrowDirection);if(this._popoverHelper){this._contentDiv.addEventListener("mousemove",this._popoverHelper._killHidePopoverTimer.bind(this._popoverHelper),true);this.element.addEventListener("mouseout",this._popoverHelper._popoverMouseOut.bind(this._popoverHelper),true);}},hide:function()
1973 {this.detach();delete WebInspector.Popover._popover;},get disposed()
1974 {return this._disposed;},dispose:function()
1975 {if(this.isShowing())
1976 this.hide();this._disposed=true;},setCanShrink:function(canShrink)
1977 {this._hasFixedHeight=!canShrink;this._contentDiv.classList.add("fixed-height");},_positionElement:function(anchorElement,preferredWidth,preferredHeight,arrowDirection)
1978 {const borderWidth=25;const scrollerWidth=this._hasFixedHeight?0:11;const arrowHeight=15;const arrowOffset=10;const borderRadius=10;preferredWidth=Math.max(preferredWidth,50);const container=WebInspector.inspectorView.devtoolsElement();const totalWidth=container.offsetWidth;const totalHeight=container.offsetHeight;var anchorBox=anchorElement instanceof AnchorBox?anchorElement:anchorElement.boxInWindow(window);anchorBox=anchorBox.relativeToElement(container);var newElementPosition={x:0,y:0,width:preferredWidth+scrollerWidth,height:preferredHeight};var verticalAlignment;var roomAbove=anchorBox.y;var roomBelow=totalHeight-anchorBox.y-anchorBox.height;if((roomAbove>roomBelow)||(arrowDirection===WebInspector.Popover.Orientation.Bottom)){if((anchorBox.y>newElementPosition.height+arrowHeight+borderRadius)||(arrowDirection===WebInspector.Popover.Orientation.Bottom))
1979 newElementPosition.y=anchorBox.y-newElementPosition.height-arrowHeight;else{newElementPosition.y=borderRadius;newElementPosition.height=anchorBox.y-borderRadius*2-arrowHeight;if(this._hasFixedHeight&&newElementPosition.height<preferredHeight){newElementPosition.y=borderRadius;newElementPosition.height=preferredHeight;}}
1980 verticalAlignment=WebInspector.Popover.Orientation.Bottom;}else{newElementPosition.y=anchorBox.y+anchorBox.height+arrowHeight;if((newElementPosition.y+newElementPosition.height+arrowHeight-borderWidth>=totalHeight)&&(arrowDirection!==WebInspector.Popover.Orientation.Top)){newElementPosition.height=totalHeight-anchorBox.y-anchorBox.height-borderRadius*2-arrowHeight;if(this._hasFixedHeight&&newElementPosition.height<preferredHeight){newElementPosition.y=totalHeight-preferredHeight-borderRadius;newElementPosition.height=preferredHeight;}}
1981 verticalAlignment=WebInspector.Popover.Orientation.Top;}
1982 var horizontalAlignment;if(anchorBox.x+newElementPosition.width<totalWidth){newElementPosition.x=Math.max(borderRadius,anchorBox.x-borderRadius-arrowOffset);horizontalAlignment="left";}else if(newElementPosition.width+borderRadius*2<totalWidth){newElementPosition.x=totalWidth-newElementPosition.width-borderRadius;horizontalAlignment="right";var arrowRightPosition=Math.max(0,totalWidth-anchorBox.x-anchorBox.width-borderRadius-arrowOffset);arrowRightPosition+=anchorBox.width/2;arrowRightPosition=Math.min(arrowRightPosition,newElementPosition.width-borderRadius-arrowOffset);this._popupArrowElement.style.right=arrowRightPosition+"px";}else{newElementPosition.x=borderRadius;newElementPosition.width=totalWidth-borderRadius*2;newElementPosition.height+=scrollerWidth;horizontalAlignment="left";if(verticalAlignment===WebInspector.Popover.Orientation.Bottom)
1983 newElementPosition.y-=scrollerWidth;this._popupArrowElement.style.left=Math.max(0,anchorBox.x-borderRadius*2-arrowOffset)+"px";this._popupArrowElement.style.left+=anchorBox.width/2;}
1984 this.element.className="popover custom-popup-vertical-scroll custom-popup-horizontal-scroll "+verticalAlignment+"-"+horizontalAlignment+"-arrow";this.element.positionAt(newElementPosition.x-borderWidth,newElementPosition.y-borderWidth,container);this.element.style.width=newElementPosition.width+borderWidth*2+"px";this.element.style.height=newElementPosition.height+borderWidth*2+"px";},__proto__:WebInspector.View.prototype}
1985 WebInspector.PopoverHelper=function(panelElement,getAnchor,showPopover,onHide,disableOnClick)
1986 {this._panelElement=panelElement;this._getAnchor=getAnchor;this._showPopover=showPopover;this._onHide=onHide;this._disableOnClick=!!disableOnClick;panelElement.addEventListener("mousedown",this._mouseDown.bind(this),false);panelElement.addEventListener("mousemove",this._mouseMove.bind(this),false);panelElement.addEventListener("mouseout",this._mouseOut.bind(this),false);this.setTimeout(1000);}
1987 WebInspector.PopoverHelper.prototype={setTimeout:function(timeout)
1988 {this._timeout=timeout;},_eventInHoverElement:function(event)
1989 {if(!this._hoverElement)
1990 return false;var box=this._hoverElement instanceof AnchorBox?this._hoverElement:this._hoverElement.boxInWindow();return(box.x<=event.clientX&&event.clientX<=box.x+box.width&&box.y<=event.clientY&&event.clientY<=box.y+box.height);},_mouseDown:function(event)
1991 {if(this._disableOnClick||!this._eventInHoverElement(event))
1992 this.hidePopover();else{this._killHidePopoverTimer();this._handleMouseAction(event,true);}},_mouseMove:function(event)
1993 {if(this._eventInHoverElement(event))
1994 return;this._startHidePopoverTimer();this._handleMouseAction(event,false);},_popoverMouseOut:function(event)
1995 {if(!this.isPopoverVisible())
1996 return;if(event.relatedTarget&&!event.relatedTarget.isSelfOrDescendant(this._popover._contentDiv))
1997 this._startHidePopoverTimer();},_mouseOut:function(event)
1998 {if(!this.isPopoverVisible())
1999 return;if(!this._eventInHoverElement(event))
2000 this._startHidePopoverTimer();},_startHidePopoverTimer:function()
2001 {if(!this._popover||this._hidePopoverTimer)
2002 return;function doHide()
2003 {this._hidePopover();delete this._hidePopoverTimer;}
2004 this._hidePopoverTimer=setTimeout(doHide.bind(this),this._timeout/2);},_handleMouseAction:function(event,isMouseDown)
2005 {this._resetHoverTimer();if(event.which&&this._disableOnClick)
2006 return;this._hoverElement=this._getAnchor(event.target,event);if(!this._hoverElement)
2007 return;const toolTipDelay=isMouseDown?0:(this._popup?this._timeout*0.6:this._timeout);this._hoverTimer=setTimeout(this._mouseHover.bind(this,this._hoverElement),toolTipDelay);},_resetHoverTimer:function()
2008 {if(this._hoverTimer){clearTimeout(this._hoverTimer);delete this._hoverTimer;}},isPopoverVisible:function()
2009 {return!!this._popover;},hidePopover:function()
2010 {this._resetHoverTimer();this._hidePopover();},_hidePopover:function()
2011 {if(!this._popover)
2012 return;if(this._onHide)
2013 this._onHide();this._popover.dispose();delete this._popover;this._hoverElement=null;},_mouseHover:function(element)
2014 {delete this._hoverTimer;this._hidePopover();this._popover=new WebInspector.Popover(this);this._showPopover(element,this._popover);},_killHidePopoverTimer:function()
2015 {if(this._hidePopoverTimer){clearTimeout(this._hidePopoverTimer);delete this._hidePopoverTimer;this._resetHoverTimer();}}}
2016 WebInspector.Popover.Orientation={Top:"top",Bottom:"bottom"}
2017 WebInspector.Placard=function(title,subtitle)
2018 {this.element=document.createElementWithClass("div","placard");this.element.placard=this;this.subtitleElement=this.element.createChild("div","subtitle");this.titleElement=this.element.createChild("div","title");this.title=title;this.subtitle=subtitle;this.selected=false;}
2019 WebInspector.Placard.prototype={get title()
2020 {return this._title;},set title(x)
2021 {if(this._title===x)
2022 return;this._title=x;this.titleElement.textContent=x;},get subtitle()
2023 {return this._subtitle;},set subtitle(x)
2024 {if(this._subtitle===x)
2025 return;this._subtitle=x;this.subtitleElement.textContent=x;},get selected()
2026 {return this._selected;},set selected(x)
2027 {if(x)
2028 this.select();else
2029 this.deselect();},select:function()
2030 {if(this._selected)
2031 return;this._selected=true;this.element.classList.add("selected");},deselect:function()
2032 {if(!this._selected)
2033 return;this._selected=false;this.element.classList.remove("selected");},toggleSelected:function()
2034 {this.selected=!this.selected;},discard:function()
2035 {}}
2036 WebInspector.TabbedPane=function()
2037 {WebInspector.View.call(this);this.element.classList.add("tabbed-pane","vbox");this._headerElement=this.element.createChild("div","tabbed-pane-header");this._headerContentsElement=this._headerElement.createChild("div","tabbed-pane-header-contents");this._tabsElement=this._headerContentsElement.createChild("div","tabbed-pane-header-tabs");this._contentElement=this.element.createChild("div","tabbed-pane-content scroll-target");this._tabs=[];this._tabsHistory=[];this._tabsById={};this._dropDownButton=this._createDropDownButton();}
2038 WebInspector.TabbedPane.EventTypes={TabSelected:"TabSelected",TabClosed:"TabClosed"}
2039 WebInspector.TabbedPane.prototype={get visibleView()
2040 {return this._currentTab?this._currentTab.view:null;},get selectedTabId()
2041 {return this._currentTab?this._currentTab.id:null;},set shrinkableTabs(shrinkableTabs)
2042 {this._shrinkableTabs=shrinkableTabs;},set verticalTabLayout(verticalTabLayout)
2043 {this._verticalTabLayout=verticalTabLayout;},set closeableTabs(closeableTabs)
2044 {this._closeableTabs=closeableTabs;},setRetainTabOrder:function(retainTabOrder,tabOrderComparator)
2045 {this._retainTabOrder=retainTabOrder;this._tabOrderComparator=tabOrderComparator;},defaultFocusedElement:function()
2046 {return this.visibleView?this.visibleView.defaultFocusedElement():null;},focus:function()
2047 {if(this.visibleView)
2048 this.visibleView.focus();else
2049 WebInspector.View.prototype.focus.call(this);},headerElement:function()
2050 {return this._headerElement;},isTabCloseable:function(id)
2051 {var tab=this._tabsById[id];return tab?tab.isCloseable():false;},setTabDelegate:function(delegate)
2052 {var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i)
2053 tabs[i].setDelegate(delegate);this._delegate=delegate;},appendTab:function(id,tabTitle,view,tabTooltip,userGesture,isCloseable)
2054 {isCloseable=typeof isCloseable==="boolean"?isCloseable:this._closeableTabs;var tab=new WebInspector.TabbedPaneTab(this,id,tabTitle,isCloseable,view,tabTooltip);tab.setDelegate(this._delegate);this._tabsById[id]=tab;function comparator(tab1,tab2)
2055 {return this._tabOrderComparator(tab1.id,tab2.id);}
2056 if(this._retainTabOrder&&this._tabOrderComparator)
2057 this._tabs.splice(insertionIndexForObjectInListSortedByFunction(tab,this._tabs,comparator.bind(this)),0,tab);else
2058 this._tabs.push(tab);this._tabsHistory.push(tab);if(this._tabsHistory[0]===tab)
2059 this.selectTab(tab.id,userGesture);this._updateTabElements();},closeTab:function(id,userGesture)
2060 {this.closeTabs([id],userGesture);},closeTabs:function(ids,userGesture)
2061 {for(var i=0;i<ids.length;++i)
2062 this._innerCloseTab(ids[i],userGesture);this._updateTabElements();if(this._tabsHistory.length)
2063 this.selectTab(this._tabsHistory[0].id,false);},_innerCloseTab:function(id,userGesture)
2064 {if(!this._tabsById[id])
2065 return;if(userGesture&&!this._tabsById[id]._closeable)
2066 return;if(this._currentTab&&this._currentTab.id===id)
2067 this._hideCurrentTab();var tab=this._tabsById[id];delete this._tabsById[id];this._tabsHistory.splice(this._tabsHistory.indexOf(tab),1);this._tabs.splice(this._tabs.indexOf(tab),1);if(tab._shown)
2068 this._hideTabElement(tab);var eventData={tabId:id,view:tab.view,isUserGesture:userGesture};this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabClosed,eventData);return true;},hasTab:function(tabId)
2069 {return!!this._tabsById[tabId];},allTabs:function()
2070 {var result=[];var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i)
2071 result.push(tabs[i].id);return result;},otherTabs:function(id)
2072 {var result=[];var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i){if(tabs[i].id!==id)
2073 result.push(tabs[i].id);}
2074 return result;},selectTab:function(id,userGesture)
2075 {var tab=this._tabsById[id];if(!tab)
2076 return;if(this._currentTab&&this._currentTab.id===id)
2077 return;this._hideCurrentTab();this._showTab(tab);this._currentTab=tab;this._tabsHistory.splice(this._tabsHistory.indexOf(tab),1);this._tabsHistory.splice(0,0,tab);this._updateTabElements();var eventData={tabId:id,view:tab.view,isUserGesture:userGesture};this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabSelected,eventData);},lastOpenedTabIds:function(tabsCount)
2078 {function tabToTabId(tab){return tab.id;}
2079 return this._tabsHistory.slice(0,tabsCount).map(tabToTabId);},setTabIcon:function(id,iconClass,iconTooltip)
2080 {var tab=this._tabsById[id];if(tab._setIconClass(iconClass,iconTooltip))
2081 this._updateTabElements();},changeTabTitle:function(id,tabTitle)
2082 {var tab=this._tabsById[id];if(tab.title===tabTitle)
2083 return;tab.title=tabTitle;this._updateTabElements();},changeTabView:function(id,view)
2084 {var tab=this._tabsById[id];if(this._currentTab&&this._currentTab.id===tab.id){if(tab.view!==view)
2085 this._hideTab(tab);tab.view=view;this._showTab(tab);}else
2086 tab.view=view;},changeTabTooltip:function(id,tabTooltip)
2087 {var tab=this._tabsById[id];tab.tooltip=tabTooltip;},onResize:function()
2088 {this._updateTabElements();},headerResized:function()
2089 {this._updateTabElements();},_updateTabElements:function()
2090 {WebInspector.invokeOnceAfterBatchUpdate(this,this._innerUpdateTabElements);},setPlaceholderText:function(text)
2091 {this._noTabsMessage=text;},_innerUpdateTabElements:function()
2092 {if(!this.isShowing())
2093 return;if(!this._tabs.length){this._contentElement.classList.add("has-no-tabs");if(this._noTabsMessage&&!this._noTabsMessageElement){this._noTabsMessageElement=this._contentElement.createChild("div","tabbed-pane-placeholder fill");this._noTabsMessageElement.textContent=this._noTabsMessage;}}else{this._contentElement.classList.remove("has-no-tabs");if(this._noTabsMessageElement){this._noTabsMessageElement.remove();delete this._noTabsMessageElement;}}
2094 if(!this._measuredDropDownButtonWidth)
2095 this._measureDropDownButton();this._updateWidths();this._updateTabsDropDown();},_showTabElement:function(index,tab)
2096 {if(index>=this._tabsElement.children.length)
2097 this._tabsElement.appendChild(tab.tabElement);else
2098 this._tabsElement.insertBefore(tab.tabElement,this._tabsElement.children[index]);tab._shown=true;},_hideTabElement:function(tab)
2099 {this._tabsElement.removeChild(tab.tabElement);tab._shown=false;},_createDropDownButton:function()
2100 {var dropDownContainer=document.createElement("div");dropDownContainer.classList.add("tabbed-pane-header-tabs-drop-down-container");var dropDownButton=dropDownContainer.createChild("div","tabbed-pane-header-tabs-drop-down");dropDownButton.appendChild(document.createTextNode("\u00bb"));this._tabsSelect=dropDownButton.createChild("select","tabbed-pane-header-tabs-drop-down-select");this._tabsSelect.addEventListener("change",this._tabsSelectChanged.bind(this),false);this._tabsSelect.addEventListener("mousedown",consumeEvent,false);return dropDownContainer;},_totalWidth:function()
2101 {return this._headerContentsElement.getBoundingClientRect().width;},_updateTabsDropDown:function()
2102 {var tabsToShowIndexes=this._tabsToShowIndexes(this._tabs,this._tabsHistory,this._totalWidth(),this._measuredDropDownButtonWidth);for(var i=0;i<this._tabs.length;++i){if(this._tabs[i]._shown&&tabsToShowIndexes.indexOf(i)===-1)
2103 this._hideTabElement(this._tabs[i]);}
2104 for(var i=0;i<tabsToShowIndexes.length;++i){var tab=this._tabs[tabsToShowIndexes[i]];if(!tab._shown)
2105 this._showTabElement(i,tab);}
2106 this._populateDropDownFromIndex();},_populateDropDownFromIndex:function()
2107 {if(this._dropDownButton.parentElement)
2108 this._headerContentsElement.removeChild(this._dropDownButton);this._tabsSelect.removeChildren();var tabsToShow=[];for(var i=0;i<this._tabs.length;++i){if(!this._tabs[i]._shown)
2109 tabsToShow.push(this._tabs[i]);continue;}
2110 function compareFunction(tab1,tab2)
2111 {return tab1.title.localeCompare(tab2.title);}
2112 if(!this._retainTabOrder)
2113 tabsToShow.sort(compareFunction);var selectedIndex=-1;for(var i=0;i<tabsToShow.length;++i){var option=new Option(tabsToShow[i].title);option.tab=tabsToShow[i];this._tabsSelect.appendChild(option);if(this._tabsHistory[0]===tabsToShow[i])
2114 selectedIndex=i;}
2115 if(this._tabsSelect.options.length){this._headerContentsElement.appendChild(this._dropDownButton);this._tabsSelect.selectedIndex=selectedIndex;}},_tabsSelectChanged:function()
2116 {var options=this._tabsSelect.options;var selectedOption=options[this._tabsSelect.selectedIndex];this.selectTab(selectedOption.tab.id,true);},_measureDropDownButton:function()
2117 {this._dropDownButton.classList.add("measuring");this._headerContentsElement.appendChild(this._dropDownButton);this._measuredDropDownButtonWidth=this._dropDownButton.getBoundingClientRect().width;this._headerContentsElement.removeChild(this._dropDownButton);this._dropDownButton.classList.remove("measuring");},_updateWidths:function()
2118 {var measuredWidths=this._measureWidths();var maxWidth=this._shrinkableTabs?this._calculateMaxWidth(measuredWidths.slice(),this._totalWidth()):Number.MAX_VALUE;var i=0;for(var tabId in this._tabs){var tab=this._tabs[tabId];tab.setWidth(this._verticalTabLayout?-1:Math.min(maxWidth,measuredWidths[i++]));}},_measureWidths:function()
2119 {this._tabsElement.style.setProperty("width","2000px");var measuringTabElements=[];for(var tabId in this._tabs){var tab=this._tabs[tabId];if(typeof tab._measuredWidth==="number")
2120 continue;var measuringTabElement=tab._createTabElement(true);measuringTabElement.__tab=tab;measuringTabElements.push(measuringTabElement);this._tabsElement.appendChild(measuringTabElement);}
2121 for(var i=0;i<measuringTabElements.length;++i)
2122 measuringTabElements[i].__tab._measuredWidth=measuringTabElements[i].getBoundingClientRect().width;for(var i=0;i<measuringTabElements.length;++i)
2123 measuringTabElements[i].remove();var measuredWidths=[];for(var tabId in this._tabs)
2124 measuredWidths.push(this._tabs[tabId]._measuredWidth);this._tabsElement.style.removeProperty("width");return measuredWidths;},_calculateMaxWidth:function(measuredWidths,totalWidth)
2125 {if(!measuredWidths.length)
2126 return 0;measuredWidths.sort(function(x,y){return x-y});var totalMeasuredWidth=0;for(var i=0;i<measuredWidths.length;++i)
2127 totalMeasuredWidth+=measuredWidths[i];if(totalWidth>=totalMeasuredWidth)
2128 return measuredWidths[measuredWidths.length-1];var totalExtraWidth=0;for(var i=measuredWidths.length-1;i>0;--i){var extraWidth=measuredWidths[i]-measuredWidths[i-1];totalExtraWidth+=(measuredWidths.length-i)*extraWidth;if(totalWidth+totalExtraWidth>=totalMeasuredWidth)
2129 return measuredWidths[i-1]+(totalWidth+totalExtraWidth-totalMeasuredWidth)/(measuredWidths.length-i);}
2130 return totalWidth/measuredWidths.length;},_tabsToShowIndexes:function(tabsOrdered,tabsHistory,totalWidth,measuredDropDownButtonWidth)
2131 {var tabsToShowIndexes=[];var totalTabsWidth=0;var tabCount=tabsOrdered.length;for(var i=0;i<tabCount;++i){var tab=this._retainTabOrder?tabsOrdered[i]:tabsHistory[i];totalTabsWidth+=tab.width();var minimalRequiredWidth=totalTabsWidth;if(i!==tabCount-1)
2132 minimalRequiredWidth+=measuredDropDownButtonWidth;if(!this._verticalTabLayout&&minimalRequiredWidth>totalWidth)
2133 break;tabsToShowIndexes.push(tabsOrdered.indexOf(tab));}
2134 tabsToShowIndexes.sort(function(x,y){return x-y});return tabsToShowIndexes;},_hideCurrentTab:function()
2135 {if(!this._currentTab)
2136 return;this._hideTab(this._currentTab);delete this._currentTab;},_showTab:function(tab)
2137 {tab.tabElement.classList.add("selected");tab.view.show(this._contentElement);},_hideTab:function(tab)
2138 {tab.tabElement.classList.remove("selected");tab.view.detach();},canHighlightPosition:function()
2139 {return!!(this._currentTab&&this._currentTab.view&&this._currentTab.view.canHighlightPosition());},highlightPosition:function(line,column)
2140 {if(this.canHighlightPosition())
2141 this._currentTab.view.highlightPosition(line,column);},elementsToRestoreScrollPositionsFor:function()
2142 {return[this._contentElement];},_insertBefore:function(tab,index)
2143 {this._tabsElement.insertBefore(tab._tabElement,this._tabsElement.childNodes[index]);var oldIndex=this._tabs.indexOf(tab);this._tabs.splice(oldIndex,1);if(oldIndex<index)
2144 --index;this._tabs.splice(index,0,tab);},__proto__:WebInspector.View.prototype}
2145 WebInspector.TabbedPaneTab=function(tabbedPane,id,title,closeable,view,tooltip)
2146 {this._closeable=closeable;this._tabbedPane=tabbedPane;this._id=id;this._title=title;this._tooltip=tooltip;this._view=view;this._shown=false;this._measuredWidth;this._tabElement;}
2147 WebInspector.TabbedPaneTab.prototype={get id()
2148 {return this._id;},get title()
2149 {return this._title;},set title(title)
2150 {if(title===this._title)
2151 return;this._title=title;if(this._titleElement)
2152 this._titleElement.textContent=title;delete this._measuredWidth;},iconClass:function()
2153 {return this._iconClass;},isCloseable:function()
2154 {return this._closeable;},_setIconClass:function(iconClass,iconTooltip)
2155 {if(iconClass===this._iconClass&&iconTooltip===this._iconTooltip)
2156 return false;this._iconClass=iconClass;this._iconTooltip=iconTooltip;if(this._iconElement)
2157 this._iconElement.remove();if(this._iconClass&&this._tabElement)
2158 this._iconElement=this._createIconElement(this._tabElement,this._titleElement);delete this._measuredWidth;return true;},get view()
2159 {return this._view;},set view(view)
2160 {this._view=view;},get tooltip()
2161 {return this._tooltip;},set tooltip(tooltip)
2162 {this._tooltip=tooltip;if(this._titleElement)
2163 this._titleElement.title=tooltip||"";},get tabElement()
2164 {if(!this._tabElement)
2165 this._tabElement=this._createTabElement(false);return this._tabElement;},width:function()
2166 {return this._width;},setWidth:function(width)
2167 {this.tabElement.style.width=width===-1?"":(width+"px");this._width=width;},setDelegate:function(delegate)
2168 {this._delegate=delegate;},_createIconElement:function(tabElement,titleElement)
2169 {var iconElement=document.createElement("span");iconElement.className="tabbed-pane-header-tab-icon "+this._iconClass;if(this._iconTooltip)
2170 iconElement.title=this._iconTooltip;tabElement.insertBefore(iconElement,titleElement);return iconElement;},_createTabElement:function(measuring)
2171 {var tabElement=document.createElement("div");tabElement.classList.add("tabbed-pane-header-tab");tabElement.id="tab-"+this._id;tabElement.tabIndex=-1;tabElement.selectTabForTest=this._tabbedPane.selectTab.bind(this._tabbedPane,this.id,true);var titleElement=tabElement.createChild("span","tabbed-pane-header-tab-title");titleElement.textContent=this.title;titleElement.title=this.tooltip||"";if(this._iconClass)
2172 this._createIconElement(tabElement,titleElement);if(!measuring)
2173 this._titleElement=titleElement;if(this._closeable)
2174 tabElement.createChild("div","close-button-gray");if(measuring){tabElement.classList.add("measuring");}else{tabElement.addEventListener("click",this._tabClicked.bind(this),false);tabElement.addEventListener("mousedown",this._tabMouseDown.bind(this),false);tabElement.addEventListener("mouseup",this._tabMouseUp.bind(this),false);if(this._closeable){tabElement.addEventListener("contextmenu",this._tabContextMenu.bind(this),false);WebInspector.installDragHandle(tabElement,this._startTabDragging.bind(this),this._tabDragging.bind(this),this._endTabDragging.bind(this),"pointer");}}
2175 return tabElement;},_tabClicked:function(event)
2176 {var middleButton=event.button===1;var shouldClose=this._closeable&&(middleButton||event.target.classList.contains("close-button-gray"));if(!shouldClose){this._tabbedPane.focus();return;}
2177 this._closeTabs([this.id]);event.consume(true);},_tabMouseDown:function(event)
2178 {if(event.target.classList.contains("close-button-gray")||event.button===1)
2179 return;this._tabbedPane.selectTab(this.id,true);},_tabMouseUp:function(event)
2180 {if(event.button===1)
2181 event.consume(true);},_closeTabs:function(ids)
2182 {if(this._delegate){this._delegate.closeTabs(this._tabbedPane,ids);return;}
2183 this._tabbedPane.closeTabs(ids,true);},_tabContextMenu:function(event)
2184 {function close()
2185 {this._closeTabs([this.id]);}
2186 function closeOthers()
2187 {this._closeTabs(this._tabbedPane.otherTabs(this.id));}
2188 function closeAll()
2189 {this._closeTabs(this._tabbedPane.allTabs());}
2190 var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString("Close"),close.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Close others":"Close Others"),closeOthers.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Close all":"Close All"),closeAll.bind(this));contextMenu.show();},_startTabDragging:function(event)
2191 {if(event.target.classList.contains("close-button-gray"))
2192 return false;this._dragStartX=event.pageX;return true;},_tabDragging:function(event)
2193 {var tabElements=this._tabbedPane._tabsElement.childNodes;for(var i=0;i<tabElements.length;++i){var tabElement=tabElements[i];if(tabElement===this._tabElement)
2194 continue;var intersects=tabElement.offsetLeft+tabElement.clientWidth>this._tabElement.offsetLeft&&this._tabElement.offsetLeft+this._tabElement.clientWidth>tabElement.offsetLeft;if(!intersects)
2195 continue;if(Math.abs(event.pageX-this._dragStartX)<tabElement.clientWidth/2+5)
2196 break;if(event.pageX-this._dragStartX>0){tabElement=tabElement.nextSibling;++i;}
2197 var oldOffsetLeft=this._tabElement.offsetLeft;this._tabbedPane._insertBefore(this,i);this._dragStartX+=this._tabElement.offsetLeft-oldOffsetLeft;break;}
2198 if(!this._tabElement.previousSibling&&event.pageX-this._dragStartX<0){this._tabElement.style.setProperty("left","0px");return;}
2199 if(!this._tabElement.nextSibling&&event.pageX-this._dragStartX>0){this._tabElement.style.setProperty("left","0px");return;}
2200 this._tabElement.style.setProperty("position","relative");this._tabElement.style.setProperty("left",(event.pageX-this._dragStartX)+"px");},_endTabDragging:function(event)
2201 {this._tabElement.style.removeProperty("position");this._tabElement.style.removeProperty("left");delete this._dragStartX;}}
2202 WebInspector.TabbedPaneTabDelegate=function()
2203 {}
2204 WebInspector.TabbedPaneTabDelegate.prototype={closeTabs:function(tabbedPane,ids){}}
2205 WebInspector.ViewportControl=function(provider)
2206 {this.element=document.createElement("div");this.element.className="fill";this.element.style.overflow="auto";this._topGapElement=this.element.createChild("div");this._contentElement=this.element.createChild("div");this._bottomGapElement=this.element.createChild("div");this._provider=provider;this.element.addEventListener("scroll",this._onScroll.bind(this),false);this._firstVisibleIndex=0;this._lastVisibleIndex=-1;}
2207 WebInspector.ViewportControl.Provider=function()
2208 {}
2209 WebInspector.ViewportControl.Provider.prototype={itemCount:function(){return 0;},itemElement:function(index){return null;}}
2210 WebInspector.ViewportControl.prototype={contentElement:function()
2211 {return this._contentElement;},refresh:function()
2212 {if(!this.element.clientHeight)
2213 return;this._contentElement.style.setProperty("height","100000px");this._contentElement.removeChildren();var itemCount=this._provider.itemCount();if(!itemCount){this._firstVisibleIndex=-1;this._lastVisibleIndex=-1;return;}
2214 if(!this._rowHeight){var firstElement=this._provider.itemElement(0);this._rowHeight=firstElement.measurePreferredSize(this._contentElement).height;}
2215 var visibleFrom=this.element.scrollTop;var visibleTo=visibleFrom+this.element.clientHeight;this._firstVisibleIndex=Math.floor(visibleFrom/this._rowHeight);this._lastVisibleIndex=Math.min(Math.ceil(visibleTo/this._rowHeight),itemCount)-1;this._topGapElement.style.height=(this._rowHeight*this._firstVisibleIndex)+"px";this._bottomGapElement.style.height=(this._rowHeight*(itemCount-this._lastVisibleIndex-1))+"px";for(var i=this._firstVisibleIndex;i<=this._lastVisibleIndex;++i)
2216 this._contentElement.appendChild(this._provider.itemElement(i));this._contentElement.style.removeProperty("height");},_onScroll:function(event)
2217 {this.refresh();},rowsPerViewport:function()
2218 {return Math.floor(this.element.clientHeight/this._rowHeight);},firstVisibleIndex:function()
2219 {return this._firstVisibleIndex;},lastVisibleIndex:function()
2220 {return this._lastVisibleIndex;},renderedElementAt:function(index)
2221 {if(index<this._firstVisibleIndex)
2222 return null;if(index>this._lastVisibleIndex)
2223 return null;return this._contentElement.childNodes[index-this._firstVisibleIndex];},scrollItemIntoView:function(index,makeLast)
2224 {if(index>this._firstVisibleIndex&&index<this._lastVisibleIndex)
2225 return;if(makeLast)
2226 this.element.scrollTop=this._rowHeight*(index+1)-this.element.clientHeight;else
2227 this.element.scrollTop=this._rowHeight*index;}}
2228 WebInspector.Drawer=function(inspectorView)
2229 {this._inspectorView=inspectorView;this.element=this._inspectorView.devtoolsElement().createChild("div","drawer");this.element.style.flexBasis=0;this._savedHeight=200;this._drawerContentsElement=this.element.createChild("div");this._drawerContentsElement.id="drawer-contents";this._toggleDrawerButton=new WebInspector.StatusBarButton(WebInspector.UIString("Show drawer."),"console-status-bar-item");this._toggleDrawerButton.addEventListener("click",this.toggle,this);this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.closeableTabs=false;this._tabbedPane.markAsRoot();this._tabbedPane.setRetainTabOrder(true,WebInspector.moduleManager.orderComparator(WebInspector.Drawer.ViewFactory,"name","order"));this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabClosed,this._updateTabStrip,this);this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);WebInspector.installDragHandle(this._tabbedPane.headerElement(),this._startStatusBarDragging.bind(this),this._statusBarDragging.bind(this),this._endStatusBarDragging.bind(this),"ns-resize");this._tabbedPane.element.createChild("div","drawer-resizer");this._showDrawerOnLoadSetting=WebInspector.settings.createSetting("WebInspector.Drawer.showOnLoad",false);this._lastSelectedViewSetting=WebInspector.settings.createSetting("WebInspector.Drawer.lastSelectedView","console");this._initialize();}
2230 WebInspector.Drawer.prototype={_initialize:function()
2231 {this._viewFactories={};var extensions=WebInspector.moduleManager.extensions(WebInspector.Drawer.ViewFactory);for(var i=0;i<extensions.length;++i){var descriptor=extensions[i].descriptor();var id=descriptor["name"];var title=WebInspector.UIString(descriptor["title"]);var settingName=descriptor["setting"];var setting=settingName?(WebInspector.settings[settingName]):null;this._viewFactories[id]=extensions[i];if(setting){setting.addChangeListener(this._toggleSettingBasedView.bind(this,id,title,setting));if(setting.get())
2232 this._tabbedPane.appendTab(id,title,new WebInspector.View());}else{this._tabbedPane.appendTab(id,title,new WebInspector.View());}}},_toggleSettingBasedView:function(id,title,setting)
2233 {this._tabbedPane.closeTab(id);if(setting.get())
2234 this._tabbedPane.appendTab(id,title,new WebInspector.View());},toggleButtonElement:function()
2235 {return this._toggleDrawerButton.element;},_constrainHeight:function(height)
2236 {return Number.constrain(height,Preferences.minConsoleHeight,this._inspectorView.devtoolsElement().offsetHeight-Preferences.minConsoleHeight);},isHiding:function()
2237 {return this._isHiding;},_addView:function(tabId,title,view)
2238 {if(!this._tabbedPane.hasTab(tabId)){this._tabbedPane.appendTab(tabId,title,view,undefined,false);}else{this._tabbedPane.changeTabTitle(tabId,title);this._tabbedPane.changeTabView(tabId,view);}},closeView:function(id)
2239 {this._tabbedPane.closeTab(id);},showView:function(id,immediately)
2240 {if(!this._toggleDrawerButton.enabled())
2241 return;var viewFactory=this._viewFactory(id);if(viewFactory)
2242 this._tabbedPane.changeTabView(id,viewFactory.createView());this._innerShow(immediately);this._tabbedPane.selectTab(id,true);this._lastSelectedViewSetting.set(id);this._updateTabStrip();},showCloseableView:function(id,title,view)
2243 {if(!this._toggleDrawerButton.enabled())
2244 return;if(!this._tabbedPane.hasTab(id)){this._tabbedPane.appendTab(id,title,view,undefined,false,true);}else{this._tabbedPane.changeTabView(id,view);this._tabbedPane.changeTabTitle(id,title);}
2245 this._innerShow();this._tabbedPane.selectTab(id,true);this._updateTabStrip();},show:function(immediately)
2246 {this.showView(this._lastSelectedViewSetting.get(),immediately);},showOnLoadIfNecessary:function()
2247 {if(this._showDrawerOnLoadSetting.get())
2248 this.showView(this._lastSelectedViewSetting.get(),true);},_innerShow:function(immediately)
2249 {this._immediatelyFinishAnimation();if(this._toggleDrawerButton.toggled)
2250 return;this._showDrawerOnLoadSetting.set(true);this._toggleDrawerButton.toggled=true;this._toggleDrawerButton.title=WebInspector.UIString("Hide drawer.");document.body.classList.add("drawer-visible");this._tabbedPane.show(this._drawerContentsElement);var height=this._constrainHeight(this._savedHeight);if(window.innerHeight==0)
2251 height=this._savedHeight;var animations=[{element:this.element,start:{"flex-basis":23},end:{"flex-basis":height}},];function animationCallback(finished)
2252 {if(this._inspectorView.currentPanel())
2253 this._inspectorView.currentPanel().doResize();if(!finished)
2254 return;this._updateTabStrip();if(this._visibleView()){this._tabbedPane.changeTabView(this._tabbedPane.selectedTabId,this._visibleView());this._visibleView().focus();}
2255 delete this._currentAnimation;}
2256 this._currentAnimation=WebInspector.animateStyle(animations,this._animationDuration(immediately),animationCallback.bind(this));if(immediately)
2257 this._currentAnimation.forceComplete();},hide:function(immediately)
2258 {this._immediatelyFinishAnimation();if(!this._toggleDrawerButton.toggled)
2259 return;this._showDrawerOnLoadSetting.set(false);this._toggleDrawerButton.toggled=false;this._toggleDrawerButton.title=WebInspector.UIString("Show console.");this._isHiding=true;this._savedHeight=this.element.offsetHeight;WebInspector.restoreFocusFromElement(this.element);document.body.classList.remove("drawer-visible");this._inspectorView.currentPanel().statusBarResized();document.body.classList.add("drawer-visible");var animations=[{element:this.element,start:{"flex-basis":this.element.offsetHeight},end:{"flex-basis":23}},];function animationCallback(finished)
2260 {var panel=this._inspectorView.currentPanel();if(!finished){panel.doResize();return;}
2261 this._tabbedPane.detach();this._drawerContentsElement.removeChildren();document.body.classList.remove("drawer-visible");panel.doResize();delete this._currentAnimation;delete this._isHiding;}
2262 this._currentAnimation=WebInspector.animateStyle(animations,this._animationDuration(immediately),animationCallback.bind(this));if(immediately)
2263 this._currentAnimation.forceComplete();},resize:function()
2264 {if(!this._toggleDrawerButton.toggled)
2265 return;this._visibleView().storeScrollPositions();var height=this._constrainHeight(this.element.offsetHeight);this.element.style.flexBasis=height+"px";this._tabbedPane.doResize();},_immediatelyFinishAnimation:function()
2266 {if(this._currentAnimation)
2267 this._currentAnimation.forceComplete();},_animationDuration:function(immediately)
2268 {return immediately?0:50;},_startStatusBarDragging:function(event)
2269 {if(!this._toggleDrawerButton.toggled||event.target!==this._tabbedPane.headerElement())
2270 return false;this._visibleView().storeScrollPositions();this._statusBarDragOffset=event.pageY-this.element.totalOffsetTop();return true;},_statusBarDragging:function(event)
2271 {var height=window.innerHeight-event.pageY+this._statusBarDragOffset;height=Number.constrain(height,Preferences.minConsoleHeight,this._inspectorView.devtoolsElement().offsetHeight-Preferences.minConsoleHeight);this.element.style.flexBasis=height+"px";if(this._inspectorView.currentPanel())
2272 this._inspectorView.currentPanel().doResize();this._tabbedPane.doResize();event.consume(true);},_endStatusBarDragging:function(event)
2273 {this._savedHeight=this.element.offsetHeight;delete this._statusBarDragOffset;event.consume();},_visibleView:function()
2274 {return this._tabbedPane.visibleView;},_updateTabStrip:function()
2275 {this._tabbedPane.onResize();this._tabbedPane.doResize();},_tabSelected:function(event)
2276 {var tabId=this._tabbedPane.selectedTabId;if(event.data["isUserGesture"]&&!this._tabbedPane.isTabCloseable(tabId))
2277 this._lastSelectedViewSetting.set(tabId);var viewFactory=this._viewFactory(tabId);if(viewFactory)
2278 this._tabbedPane.changeTabView(tabId,viewFactory.createView());},toggle:function()
2279 {if(this._toggleDrawerButton.toggled)
2280 this.hide();else
2281 this.show();},visible:function()
2282 {return this._toggleDrawerButton.toggled;},selectedViewId:function()
2283 {return this._tabbedPane.selectedTabId;},_viewFactory:function(id)
2284 {return this._viewFactories[id]?(this._viewFactories[id].instance()):null;}}
2285 WebInspector.Drawer.ViewFactory=function()
2286 {}
2287 WebInspector.Drawer.ViewFactory.prototype={createView:function(){}}
2288 WebInspector.Drawer.SingletonViewFactory=function(constructor)
2289 {this._constructor=constructor;}
2290 WebInspector.Drawer.SingletonViewFactory.prototype={createView:function()
2291 {if(!this._instance)
2292 this._instance=(new this._constructor());return this._instance;}}
2293 WebInspector.ConsoleModel=function()
2294 {this.messages=[];this.warnings=0;this.errors=0;this._interruptRepeatCount=false;InspectorBackend.registerConsoleDispatcher(new WebInspector.ConsoleDispatcher(this));}
2295 WebInspector.ConsoleModel.Events={ConsoleCleared:"console-cleared",MessageAdded:"console-message-added",RepeatCountUpdated:"repeat-count-updated"}
2296 WebInspector.ConsoleModel.prototype={enableAgent:function()
2297 {if(WebInspector.settings.monitoringXHREnabled.get())
2298 ConsoleAgent.setMonitoringXHREnabled(true);this._enablingConsole=true;function callback()
2299 {delete this._enablingConsole;}
2300 ConsoleAgent.enable(callback.bind(this));},enablingConsole:function()
2301 {return!!this._enablingConsole;},addMessage:function(msg,isFromBackend)
2302 {if(isFromBackend&&WebInspector.SourceMap.hasSourceMapRequestHeader(msg.request()))
2303 return;msg.index=this.messages.length;this.messages.push(msg);this._incrementErrorWarningCount(msg);if(isFromBackend)
2304 this._previousMessage=msg;this._interruptRepeatCount=!isFromBackend;this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageAdded,msg);},_incrementErrorWarningCount:function(msg)
2305 {switch(msg.level){case WebInspector.ConsoleMessage.MessageLevel.Warning:this.warnings+=msg.repeatDelta;break;case WebInspector.ConsoleMessage.MessageLevel.Error:this.errors+=msg.repeatDelta;break;}},requestClearMessages:function()
2306 {ConsoleAgent.clearMessages();this.clearMessages();},clearMessages:function()
2307 {this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.ConsoleCleared);this.messages=[];delete this._previousMessage;this.errors=0;this.warnings=0;},_messageRepeatCountUpdated:function(count)
2308 {var msg=this._previousMessage;if(!msg)
2309 return;var prevRepeatCount=msg.totalRepeatCount;if(!this._interruptRepeatCount){msg.repeatDelta=count-prevRepeatCount;msg.repeatCount=msg.repeatCount+msg.repeatDelta;msg.totalRepeatCount=count;msg.updateRepeatCount();this._incrementErrorWarningCount(msg);this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.RepeatCountUpdated,msg);}else{var msgCopy=msg.clone();msgCopy.totalRepeatCount=count;msgCopy.repeatCount=(count-prevRepeatCount)||1;msgCopy.repeatDelta=msgCopy.repeatCount;this.addMessage(msgCopy,true);}},__proto__:WebInspector.Object.prototype}
2310 WebInspector.ConsoleMessage=function(source,level,url,line,column,repeatCount,requestId)
2311 {this.source=source;this.level=level;this.url=url||null;this.line=line||0;this.column=column||0;this.message="";repeatCount=repeatCount||1;this.repeatCount=repeatCount;this.repeatDelta=repeatCount;this.totalRepeatCount=repeatCount;this._request=requestId?WebInspector.networkLog.requestForId(requestId):null;}
2312 WebInspector.ConsoleMessage.prototype={isErrorOrWarning:function()
2313 {return(this.level===WebInspector.ConsoleMessage.MessageLevel.Warning||this.level===WebInspector.ConsoleMessage.MessageLevel.Error);},updateRepeatCount:function()
2314 {},clone:function()
2315 {},location:function()
2316 {},request:function()
2317 {return this._request;}}
2318 WebInspector.ConsoleMessage.create=function(source,level,message,type,url,line,column,repeatCount,parameters,stackTrace,requestId,isOutdated)
2319 {}
2320 WebInspector.ConsoleMessage.MessageSource={XML:"xml",JS:"javascript",Network:"network",ConsoleAPI:"console-api",Storage:"storage",AppCache:"appcache",Rendering:"rendering",CSS:"css",Security:"security",Other:"other",Deprecation:"deprecation"}
2321 WebInspector.ConsoleMessage.MessageType={Log:"log",Dir:"dir",DirXML:"dirxml",Table:"table",Trace:"trace",Clear:"clear",StartGroup:"startGroup",StartGroupCollapsed:"startGroupCollapsed",EndGroup:"endGroup",Assert:"assert",Result:"result",Profile:"profile",ProfileEnd:"profileEnd",Command:"command"}
2322 WebInspector.ConsoleMessage.MessageLevel={Log:"log",Info:"info",Warning:"warning",Error:"error",Debug:"debug"}
2323 WebInspector.ConsoleDispatcher=function(console)
2324 {this._console=console;}
2325 WebInspector.ConsoleDispatcher.prototype={messageAdded:function(payload)
2326 {var consoleMessage=WebInspector.ConsoleMessage.create(payload.source,payload.level,payload.text,payload.type,payload.url,payload.line,payload.column,payload.repeatCount,payload.parameters,payload.stackTrace,payload.networkRequestId,this._console._enablingConsole);this._console.addMessage(consoleMessage,true);},messageRepeatCountUpdated:function(count)
2327 {this._console._messageRepeatCountUpdated(count);},messagesCleared:function()
2328 {if(!WebInspector.settings.preserveConsoleLog.get())
2329 this._console.clearMessages();}}
2330 WebInspector.console;WebInspector.ConsoleMessageImpl=function(source,level,message,linkifier,type,url,line,column,repeatCount,parameters,stackTrace,requestId,isOutdated)
2331 {WebInspector.ConsoleMessage.call(this,source,level,url,line,column,repeatCount,requestId);this._linkifier=linkifier;this.type=type||WebInspector.ConsoleMessage.MessageType.Log;this._messageText=message;this._parameters=parameters;this._stackTrace=stackTrace;this._isOutdated=isOutdated;this._dataGrids=[];this._dataGridParents=new Map();this._customFormatters={"object":this._formatParameterAsObject,"array":this._formatParameterAsArray,"node":this._formatParameterAsNode,"string":this._formatParameterAsString};}
2332 WebInspector.ConsoleMessageImpl.prototype={wasShown:function()
2333 {for(var i=0;this._dataGrids&&i<this._dataGrids.length;++i){var dataGrid=this._dataGrids[i];var parentElement=this._dataGridParents.get(dataGrid)||null;dataGrid.show(parentElement);dataGrid.updateWidths();}},willHide:function()
2334 {for(var i=0;this._dataGrids&&i<this._dataGrids.length;++i){var dataGrid=this._dataGrids[i];this._dataGridParents.put(dataGrid,dataGrid.element.parentElement);dataGrid.detach();}},_formatMessage:function()
2335 {this._formattedMessage=document.createElement("span");this._formattedMessage.className="console-message-text source-code";if(this.source===WebInspector.ConsoleMessage.MessageSource.ConsoleAPI){switch(this.type){case WebInspector.ConsoleMessage.MessageType.Trace:this._messageElement=this._format(this._parameters||["console.trace()"]);break;case WebInspector.ConsoleMessage.MessageType.Clear:this._messageElement=document.createTextNode(WebInspector.UIString("Console was cleared"));this._formattedMessage.classList.add("console-info");break;case WebInspector.ConsoleMessage.MessageType.Assert:var args=[WebInspector.UIString("Assertion failed:")];if(this._parameters)
2336 args=args.concat(this._parameters);this._messageElement=this._format(args);break;case WebInspector.ConsoleMessage.MessageType.Dir:var obj=this._parameters?this._parameters[0]:undefined;var args=["%O",obj];this._messageElement=this._format(args);break;case WebInspector.ConsoleMessage.MessageType.Profile:this._messageElement=document.createTextNode(WebInspector.UIString("Profile '%s' started.",this._messageText));break;case WebInspector.ConsoleMessage.MessageType.ProfileEnd:var hashIndex=this._messageText.lastIndexOf("#");var title=this._messageText.substring(0,hashIndex);var uid=this._messageText.substring(hashIndex+1);var format=WebInspector.UIString("Profile '%s' finished.","%_");var link=WebInspector.linkifyURLAsNode("webkit-profile://CPU/"+uid,title);this._messageElement=document.createElement("span");this._formatWithSubstitutionString(format,[link],this._messageElement);break;default:var args=this._parameters||[this._messageText];this._messageElement=this._format(args);}}else if(this.source===WebInspector.ConsoleMessage.MessageSource.Network){if(this._request){this._stackTrace=this._request.initiator.stackTrace;if(this._request.initiator&&this._request.initiator.url){this.url=this._request.initiator.url;this.line=this._request.initiator.lineNumber;}
2337 this._messageElement=document.createElement("span");if(this.level===WebInspector.ConsoleMessage.MessageLevel.Error){this._messageElement.appendChild(document.createTextNode(this._request.requestMethod+" "));this._messageElement.appendChild(WebInspector.linkifyRequestAsNode(this._request));if(this._request.failed)
2338 this._messageElement.appendChild(document.createTextNode(" "+this._request.localizedFailDescription));else
2339 this._messageElement.appendChild(document.createTextNode(" "+this._request.statusCode+" ("+this._request.statusText+")"));}else{var fragment=WebInspector.linkifyStringAsFragmentWithCustomLinkifier(this._messageText,WebInspector.linkifyRequestAsNode.bind(null,this._request));this._messageElement.appendChild(fragment);}}else{if(this.url){var isExternal=!WebInspector.resourceForURL(this.url)&&!WebInspector.workspace.uiSourceCodeForURL(this.url);this._anchorElement=WebInspector.linkifyURLAsNode(this.url,this.url,"console-message-url",isExternal);}
2340 this._messageElement=this._format([this._messageText]);}}else{var args=this._parameters||[this._messageText];this._messageElement=this._format(args);}
2341 if(this.source!==WebInspector.ConsoleMessage.MessageSource.Network||this._request){if(this._stackTrace&&this._stackTrace.length&&this._stackTrace[0].scriptId){this._anchorElement=this._linkifyCallFrame(this._stackTrace[0]);}else if(this.url&&this.url!=="undefined"){this._anchorElement=this._linkifyLocation(this.url,this.line,this.column);}}
2342 this._formattedMessage.appendChild(this._messageElement);if(this._anchorElement){this._formattedMessage.appendChild(document.createTextNode(" "));this._formattedMessage.appendChild(this._anchorElement);}
2343 var dumpStackTrace=!!this._stackTrace&&this._stackTrace.length&&(this.source===WebInspector.ConsoleMessage.MessageSource.Network||this.level===WebInspector.ConsoleMessage.MessageLevel.Error||this.type===WebInspector.ConsoleMessage.MessageType.Trace);if(dumpStackTrace){var ol=document.createElement("ol");ol.className="outline-disclosure";var treeOutline=new TreeOutline(ol);var content=this._formattedMessage;var root=new TreeElement(content,null,true);content.treeElementForTest=root;treeOutline.appendChild(root);if(this.type===WebInspector.ConsoleMessage.MessageType.Trace)
2344 root.expand();this._populateStackTraceTreeElement(root);this._formattedMessage=ol;}
2345 this._message=this._messageElement.textContent;},get message()
2346 {var formattedMessage=this.formattedMessage;return this._message;},get formattedMessage()
2347 {if(!this._formattedMessage)
2348 this._formatMessage();return this._formattedMessage;},_linkifyLocation:function(url,lineNumber,columnNumber)
2349 {lineNumber=lineNumber?lineNumber-1:0;columnNumber=columnNumber?columnNumber-1:0;if(this.source===WebInspector.ConsoleMessage.MessageSource.CSS){var headerIds=WebInspector.cssModel.styleSheetIdsForURL(url);var cssLocation=new WebInspector.CSSLocation(url,lineNumber,columnNumber);return this._linkifier.linkifyCSSLocation(headerIds[0]||null,cssLocation,"console-message-url");}
2350 return this._linkifier.linkifyLocation(url,lineNumber,columnNumber,"console-message-url");},_linkifyCallFrame:function(callFrame)
2351 {var lineNumber=callFrame.lineNumber?callFrame.lineNumber-1:0;var columnNumber=callFrame.columnNumber?callFrame.columnNumber-1:0;var rawLocation=new WebInspector.DebuggerModel.Location(callFrame.scriptId,lineNumber,columnNumber);return this._linkifier.linkifyRawLocation(rawLocation,"console-message-url");},isErrorOrWarning:function()
2352 {return(this.level===WebInspector.ConsoleMessage.MessageLevel.Warning||this.level===WebInspector.ConsoleMessage.MessageLevel.Error);},_format:function(parameters)
2353 {var formattedResult=document.createElement("span");if(!parameters.length)
2354 return formattedResult;for(var i=0;i<parameters.length;++i){if(parameters[i]instanceof WebInspector.RemoteObject)
2355 continue;if(typeof parameters[i]==="object")
2356 parameters[i]=WebInspector.RemoteObject.fromPayload(parameters[i]);else
2357 parameters[i]=WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]);}
2358 var shouldFormatMessage=WebInspector.RemoteObject.type(parameters[0])==="string"&&this.type!==WebInspector.ConsoleMessage.MessageType.Result;if(shouldFormatMessage){var result=this._formatWithSubstitutionString(parameters[0].description,parameters.slice(1),formattedResult);parameters=result.unusedSubstitutions;if(parameters.length)
2359 formattedResult.appendChild(document.createTextNode(" "));}
2360 if(this.type===WebInspector.ConsoleMessage.MessageType.Table){formattedResult.appendChild(this._formatParameterAsTable(parameters));return formattedResult;}
2361 for(var i=0;i<parameters.length;++i){if(shouldFormatMessage&&parameters[i].type==="string")
2362 formattedResult.appendChild(WebInspector.linkifyStringAsFragment(parameters[i].description));else
2363 formattedResult.appendChild(this._formatParameter(parameters[i],false,true));if(i<parameters.length-1)
2364 formattedResult.appendChild(document.createTextNode(" "));}
2365 return formattedResult;},_formatParameter:function(output,forceObjectFormat,includePreview)
2366 {var type;if(forceObjectFormat)
2367 type="object";else if(output instanceof WebInspector.RemoteObject)
2368 type=output.subtype||output.type;else
2369 type=typeof output;var formatter=this._customFormatters[type];if(!formatter){formatter=this._formatParameterAsValue;output=output.description;}
2370 var span=document.createElement("span");span.className="console-formatted-"+type+" source-code";formatter.call(this,output,span,includePreview);return span;},_formatParameterAsValue:function(val,elem)
2371 {elem.appendChild(document.createTextNode(val));},_formatParameterAsObject:function(obj,elem,includePreview)
2372 {this._formatParameterAsArrayOrObject(obj,obj.description||"",elem,includePreview);},_formatParameterAsArrayOrObject:function(obj,description,elem,includePreview)
2373 {var titleElement=document.createElement("span");if(description)
2374 titleElement.createTextChild(description);if(includePreview&&obj.preview){titleElement.classList.add("console-object-preview");var lossless=this._appendObjectPreview(obj,description,titleElement);if(lossless){elem.appendChild(titleElement);return;}}
2375 var section=new WebInspector.ObjectPropertiesSection(obj,titleElement);section.enableContextMenu();elem.appendChild(section.element);var note=section.titleElement.createChild("span","object-info-state-note");note.title=WebInspector.UIString("Object state below is captured upon first expansion");},_appendObjectPreview:function(obj,description,titleElement)
2376 {var preview=obj.preview;var isArray=obj.subtype==="array";if(description)
2377 titleElement.createTextChild(" ");titleElement.createTextChild(isArray?"[":"{");for(var i=0;i<preview.properties.length;++i){if(i>0)
2378 titleElement.createTextChild(", ");var property=preview.properties[i];var name=property.name;if(!isArray||name!=i){if(/^\s|\s$|^$|\n/.test(name))
2379 name="\""+name.replace(/\n/g,"\u21B5")+"\"";titleElement.createChild("span","name").textContent=name;titleElement.createTextChild(": ");}
2380 titleElement.appendChild(this._renderPropertyPreviewOrAccessor(obj,[property]));}
2381 if(preview.overflow)
2382 titleElement.createChild("span").textContent="\u2026";titleElement.createTextChild(isArray?"]":"}");return preview.lossless;},_renderPropertyPreviewOrAccessor:function(object,propertyPath)
2383 {var property=propertyPath.peekLast();if(property.type==="accessor")
2384 return this._formatAsAccessorProperty(object,propertyPath.select("name"),false);return this._renderPropertyPreview(property.type,(property.subtype),property.value);},_renderPropertyPreview:function(type,subtype,description)
2385 {var span=document.createElement("span");span.className="console-formatted-"+type;if(type==="function"){span.textContent="function";return span;}
2386 if(type==="object"&&subtype==="regexp"){span.classList.add("console-formatted-string");span.textContent=description;return span;}
2387 if(type==="object"&&subtype==="node"&&description){span.classList.add("console-formatted-preview-node");WebInspector.DOMPresentationUtils.createSpansForNodeTitle(span,description);return span;}
2388 if(type==="string"){span.textContent="\""+description.replace(/\n/g,"\u21B5")+"\"";return span;}
2389 span.textContent=description;return span;},_formatParameterAsNode:function(object,elem)
2390 {function printNode(nodeId)
2391 {if(!nodeId){this._formatParameterAsObject(object,elem,false);return;}
2392 var treeOutline=new WebInspector.ElementsTreeOutline(false,false);treeOutline.setVisible(true);treeOutline.rootDOMNode=WebInspector.domAgent.nodeForId(nodeId);treeOutline.element.classList.add("outline-disclosure");if(!treeOutline.children[0].hasChildren)
2393 treeOutline.element.classList.add("single-node");elem.appendChild(treeOutline.element);treeOutline.element.treeElementForTest=treeOutline.children[0];}
2394 object.pushNodeToFrontend(printNode.bind(this));},useArrayPreviewInFormatter:function(array)
2395 {return this.type!==WebInspector.ConsoleMessage.MessageType.DirXML&&!!array.preview;},_formatParameterAsArray:function(array,elem)
2396 {if(this.useArrayPreviewInFormatter(array)){this._formatParameterAsArrayOrObject(array,"",elem,true);return;}
2397 const maxFlatArrayLength=100;if(this._isOutdated||array.arrayLength()>maxFlatArrayLength)
2398 this._formatParameterAsObject(array,elem,false);else
2399 array.getOwnProperties(this._printArray.bind(this,array,elem));},_formatParameterAsTable:function(parameters)
2400 {var element=document.createElement("span");var table=parameters[0];if(!table||!table.preview)
2401 return element;var columnNames=[];var preview=table.preview;var rows=[];for(var i=0;i<preview.properties.length;++i){var rowProperty=preview.properties[i];var rowPreview=rowProperty.valuePreview;if(!rowPreview)
2402 continue;var rowValue={};const maxColumnsToRender=20;for(var j=0;j<rowPreview.properties.length;++j){var cellProperty=rowPreview.properties[j];var columnRendered=columnNames.indexOf(cellProperty.name)!=-1;if(!columnRendered){if(columnNames.length===maxColumnsToRender)
2403 continue;columnRendered=true;columnNames.push(cellProperty.name);}
2404 if(columnRendered){var cellElement=this._renderPropertyPreviewOrAccessor(table,[rowProperty,cellProperty]);cellElement.classList.add("nowrap-below");rowValue[cellProperty.name]=cellElement;}}
2405 rows.push([rowProperty.name,rowValue]);}
2406 var flatValues=[];for(var i=0;i<rows.length;++i){var rowName=rows[i][0];var rowValue=rows[i][1];flatValues.push(rowName);for(var j=0;j<columnNames.length;++j)
2407 flatValues.push(rowValue[columnNames[j]]);}
2408 if(!flatValues.length)
2409 return element;columnNames.unshift(WebInspector.UIString("(index)"));var dataGrid=WebInspector.DataGrid.createSortableDataGrid(columnNames,flatValues);dataGrid.renderInline();this._dataGrids.push(dataGrid);this._dataGridParents.put(dataGrid,element);return element;},_formatParameterAsString:function(output,elem)
2410 {var span=document.createElement("span");span.className="console-formatted-string source-code";span.appendChild(WebInspector.linkifyStringAsFragment(output.description));elem.classList.remove("console-formatted-string");elem.appendChild(document.createTextNode("\""));elem.appendChild(span);elem.appendChild(document.createTextNode("\""));},_printArray:function(array,elem,properties)
2411 {if(!properties)
2412 return;var elements=[];for(var i=0;i<properties.length;++i){var property=properties[i];var name=property.name;if(isNaN(name))
2413 continue;if(property.getter)
2414 elements[name]=this._formatAsAccessorProperty(array,[name],true);else if(property.value)
2415 elements[name]=this._formatAsArrayEntry(property.value);}
2416 elem.appendChild(document.createTextNode("["));var lastNonEmptyIndex=-1;function appendUndefined(elem,index)
2417 {if(index-lastNonEmptyIndex<=1)
2418 return;var span=elem.createChild("span","console-formatted-undefined");span.textContent=WebInspector.UIString("undefined Ã— %d",index-lastNonEmptyIndex-1);}
2419 var length=array.arrayLength();for(var i=0;i<length;++i){var element=elements[i];if(!element)
2420 continue;if(i-lastNonEmptyIndex>1){appendUndefined(elem,i);elem.appendChild(document.createTextNode(", "));}
2421 elem.appendChild(element);lastNonEmptyIndex=i;if(i<length-1)
2422 elem.appendChild(document.createTextNode(", "));}
2423 appendUndefined(elem,length);elem.appendChild(document.createTextNode("]"));},_formatAsArrayEntry:function(output)
2424 {return this._formatParameter(output,output.subtype==="array",false);},_formatAsAccessorProperty:function(object,propertyPath,isArrayEntry)
2425 {var rootElement=WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan(object,propertyPath,onInvokeGetterClick.bind(this));function onInvokeGetterClick(result,wasThrown)
2426 {if(!result)
2427 return;rootElement.removeChildren();if(wasThrown){var element=rootElement.createChild("span","error-message");element.textContent=WebInspector.UIString("<exception>");element.title=result.description;}else if(isArrayEntry){rootElement.appendChild(this._formatAsArrayEntry(result));}else{const maxLength=100;var type=result.type;var subtype=result.subtype;var description="";if(type!=="function"&&result.description){if(type==="string"||subtype==="regexp")
2428 description=result.description.trimMiddle(maxLength);else
2429 description=result.description.trimEnd(maxLength);}
2430 rootElement.appendChild(this._renderPropertyPreview(type,subtype,description));}}
2431 return rootElement;},_formatWithSubstitutionString:function(format,parameters,formattedResult)
2432 {var formatters={};function parameterFormatter(force,obj)
2433 {return this._formatParameter(obj,force,false);}
2434 function stringFormatter(obj)
2435 {return obj.description;}
2436 function floatFormatter(obj)
2437 {if(typeof obj.value!=="number")
2438 return"NaN";return obj.value;}
2439 function integerFormatter(obj)
2440 {if(typeof obj.value!=="number")
2441 return"NaN";return Math.floor(obj.value);}
2442 function bypassFormatter(obj)
2443 {return(obj instanceof Node)?obj:"";}
2444 var currentStyle=null;function styleFormatter(obj)
2445 {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(isWhitelistedProperty(property))
2446 currentStyle[property]=buffer.style[property];}}
2447 function isWhitelistedProperty(property)
2448 {var prefixes=["background","border","color","font","line","margin","padding","text","-webkit-background","-webkit-border","-webkit-font","-webkit-margin","-webkit-padding","-webkit-text"];for(var i=0;i<prefixes.length;i++){if(property.startsWith(prefixes[i]))
2449 return true;}
2450 return false;}
2451 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);formatters._=bypassFormatter;function append(a,b)
2452 {if(b instanceof Node)
2453 a.appendChild(b);else if(typeof b!=="undefined"){var toAppend=WebInspector.linkifyStringAsFragment(String(b));if(currentStyle){var wrapper=document.createElement('span');for(var key in currentStyle)
2454 wrapper.style[key]=currentStyle[key];wrapper.appendChild(toAppend);toAppend=wrapper;}
2455 a.appendChild(toAppend);}
2456 return a;}
2457 return String.format(format,parameters,formatters,formattedResult,append);},clearHighlight:function()
2458 {if(!this._formattedMessage)
2459 return;var highlightedMessage=this._formattedMessage;delete this._formattedMessage;delete this._anchorElement;delete this._messageElement;this._formatMessage();this._element.replaceChild(this._formattedMessage,highlightedMessage);},highlightSearchResults:function(regexObject)
2460 {if(!this._formattedMessage)
2461 return;this._highlightSearchResultsInElement(regexObject,this._messageElement);if(this._anchorElement)
2462 this._highlightSearchResultsInElement(regexObject,this._anchorElement);this._element.scrollIntoViewIfNeeded();},_highlightSearchResultsInElement:function(regexObject,element)
2463 {regexObject.lastIndex=0;var text=element.textContent;var match=regexObject.exec(text);var matchRanges=[];while(match){matchRanges.push(new WebInspector.SourceRange(match.index,match[0].length));match=regexObject.exec(text);}
2464 WebInspector.highlightSearchResults(element,matchRanges);},matchesRegex:function(regexObject)
2465 {regexObject.lastIndex=0;return regexObject.test(this.message)||(!!this._anchorElement&&regexObject.test(this._anchorElement.textContent));},toMessageElement:function()
2466 {if(this._element)
2467 return this._element;var element=document.createElement("div");element.message=this;element.className="console-message";this._element=element;switch(this.level){case WebInspector.ConsoleMessage.MessageLevel.Log:element.classList.add("console-log-level");break;case WebInspector.ConsoleMessage.MessageLevel.Debug:element.classList.add("console-debug-level");break;case WebInspector.ConsoleMessage.MessageLevel.Warning:element.classList.add("console-warning-level");break;case WebInspector.ConsoleMessage.MessageLevel.Error:element.classList.add("console-error-level");break;case WebInspector.ConsoleMessage.MessageLevel.Info:element.classList.add("console-info-level");break;}
2468 if(this.type===WebInspector.ConsoleMessage.MessageType.StartGroup||this.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
2469 element.classList.add("console-group-title");element.appendChild(this.formattedMessage);if(this.repeatCount>1)
2470 this.updateRepeatCount();return element;},_populateStackTraceTreeElement:function(parentTreeElement)
2471 {for(var i=0;i<this._stackTrace.length;i++){var frame=this._stackTrace[i];var content=document.createElementWithClass("div","stacktrace-entry");var messageTextElement=document.createElement("span");messageTextElement.className="console-message-text source-code";var functionName=frame.functionName||WebInspector.UIString("(anonymous function)");messageTextElement.appendChild(document.createTextNode(functionName));content.appendChild(messageTextElement);if(frame.scriptId){content.appendChild(document.createTextNode(" "));var urlElement=this._linkifyCallFrame(frame);if(!urlElement)
2472 continue;content.appendChild(urlElement);}
2473 var treeElement=new TreeElement(content);parentTreeElement.appendChild(treeElement);}},updateRepeatCount:function(){if(!this._element)
2474 return;if(!this.repeatCountElement){this.repeatCountElement=document.createElement("span");this.repeatCountElement.className="bubble";this._element.insertBefore(this.repeatCountElement,this._element.firstChild);this._element.classList.add("repeated-message");}
2475 this.repeatCountElement.textContent=this.repeatCount;},toString:function()
2476 {var sourceString;switch(this.source){case WebInspector.ConsoleMessage.MessageSource.XML:sourceString="XML";break;case WebInspector.ConsoleMessage.MessageSource.JS:sourceString="JavaScript";break;case WebInspector.ConsoleMessage.MessageSource.Network:sourceString="Network";break;case WebInspector.ConsoleMessage.MessageSource.ConsoleAPI:sourceString="ConsoleAPI";break;case WebInspector.ConsoleMessage.MessageSource.Storage:sourceString="Storage";break;case WebInspector.ConsoleMessage.MessageSource.AppCache:sourceString="AppCache";break;case WebInspector.ConsoleMessage.MessageSource.Rendering:sourceString="Rendering";break;case WebInspector.ConsoleMessage.MessageSource.CSS:sourceString="CSS";break;case WebInspector.ConsoleMessage.MessageSource.Security:sourceString="Security";break;case WebInspector.ConsoleMessage.MessageSource.Other:sourceString="Other";break;}
2477 var typeString;switch(this.type){case WebInspector.ConsoleMessage.MessageType.Log:typeString="Log";break;case WebInspector.ConsoleMessage.MessageType.Dir:typeString="Dir";break;case WebInspector.ConsoleMessage.MessageType.DirXML:typeString="Dir XML";break;case WebInspector.ConsoleMessage.MessageType.Trace:typeString="Trace";break;case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:case WebInspector.ConsoleMessage.MessageType.StartGroup:typeString="Start Group";break;case WebInspector.ConsoleMessage.MessageType.EndGroup:typeString="End Group";break;case WebInspector.ConsoleMessage.MessageType.Assert:typeString="Assert";break;case WebInspector.ConsoleMessage.MessageType.Result:typeString="Result";break;case WebInspector.ConsoleMessage.MessageType.Profile:case WebInspector.ConsoleMessage.MessageType.ProfileEnd:typeString="Profiling";break;}
2478 var levelString;switch(this.level){case WebInspector.ConsoleMessage.MessageLevel.Log:levelString="Log";break;case WebInspector.ConsoleMessage.MessageLevel.Warning:levelString="Warning";break;case WebInspector.ConsoleMessage.MessageLevel.Debug:levelString="Debug";break;case WebInspector.ConsoleMessage.MessageLevel.Error:levelString="Error";break;case WebInspector.ConsoleMessage.MessageLevel.Info:levelString="Info";break;}
2479 return sourceString+" "+typeString+" "+levelString+": "+this.formattedMessage.textContent+"\n"+this.url+" line "+this.line;},get text()
2480 {return this._messageText;},location:function()
2481 {var lineNumber=this.stackTrace?this.stackTrace[0].lineNumber-1:this.line-1;var columnNumber=this.stackTrace&&this.stackTrace[0].columnNumber?this.stackTrace[0].columnNumber-1:0;return WebInspector.debuggerModel.createRawLocationByURL(this.url,lineNumber,columnNumber);},isEqual:function(msg)
2482 {if(!msg)
2483 return false;if(this._stackTrace){if(!msg._stackTrace)
2484 return false;var l=this._stackTrace;var r=msg._stackTrace;if(l.length!==r.length)
2485 return false;for(var i=0;i<l.length;i++){if(l[i].url!==r[i].url||l[i].functionName!==r[i].functionName||l[i].lineNumber!==r[i].lineNumber||l[i].columnNumber!==r[i].columnNumber)
2486 return false;}}
2487 return(this.source===msg.source)&&(this.type===msg.type)&&(this.level===msg.level)&&(this.line===msg.line)&&(this.url===msg.url)&&(this.message===msg.message)&&(this._request===msg._request);},get stackTrace()
2488 {return this._stackTrace;},clone:function()
2489 {return WebInspector.ConsoleMessage.create(this.source,this.level,this._messageText,this.type,this.url,this.line,this.column,this.repeatCount,this._parameters,this._stackTrace,this._request?this._request.requestId:undefined,this._isOutdated);},__proto__:WebInspector.ConsoleMessage.prototype}
2490 WebInspector.ConsoleView=function(hideContextSelector)
2491 {WebInspector.View.call(this);this.registerRequiredCSS("filter.css");this._searchableView=new WebInspector.SearchableView(this);this._searchableView.setMinimalSearchQuerySize(0);this._searchableView.show(this.element);this._contentsElement=this._searchableView.element;this._contentsElement.classList.add("fill","vbox","console-view");this._visibleMessagesIndices=[];this._urlToMessageCount={};this._clearConsoleButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear console log."),"clear-status-bar-item");this._clearConsoleButton.addEventListener("click",this._requestClearMessages,this);this._frameSelector=new WebInspector.StatusBarComboBox(this._frameChanged.bind(this),"console-context");this._contextSelector=new WebInspector.StatusBarComboBox(this._contextChanged.bind(this),"console-context");this._filter=new WebInspector.ConsoleViewFilter();this._filter.addEventListener(WebInspector.ConsoleViewFilter.Events.FilterChanged,this._updateMessageList.bind(this));if(hideContextSelector){this._frameSelector.element.classList.add("hidden");this._contextSelector.element.classList.add("hidden");}
2492 this._filterBar=new WebInspector.FilterBar();var statusBarElement=this._contentsElement.createChild("div","console-status-bar");statusBarElement.appendChild(this._clearConsoleButton.element);statusBarElement.appendChild(this._filterBar.filterButton().element);statusBarElement.appendChild(this._frameSelector.element);statusBarElement.appendChild(this._contextSelector.element);this._filtersContainer=this._contentsElement.createChild("div","console-filters-header hidden");this._filtersContainer.appendChild(this._filterBar.filtersElement());this._filterBar.addEventListener(WebInspector.FilterBar.Events.FiltersToggled,this._onFiltersToggled,this);this._filter.addFilters(this._filterBar);this.messagesElement=document.createElement("div");this.messagesElement.id="console-messages";this.messagesElement.className="monospace";this.messagesElement.addEventListener("click",this._messagesClicked.bind(this),true);this._contentsElement.appendChild(this.messagesElement);this._scrolledToBottom=true;this.promptElement=document.createElement("div");this.promptElement.id="console-prompt";this.promptElement.className="source-code";this.promptElement.spellcheck=false;this.messagesElement.appendChild(this.promptElement);this.messagesElement.appendChild(document.createElement("br"));this.topGroup=new WebInspector.ConsoleGroup(null);this.messagesElement.insertBefore(this.topGroup.element,this.promptElement);this.currentGroup=this.topGroup;this._registerShortcuts();this.registerRequiredCSS("textPrompt.css");this.messagesElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),false);WebInspector.settings.monitoringXHREnabled.addChangeListener(this._monitoringXHREnabledSettingChanged.bind(this));WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._consoleMessageAdded,this);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);this._linkifier=new WebInspector.Linkifier();this.prompt=new WebInspector.TextPromptWithHistory(WebInspector.runtimeModel.completionsForTextPrompt.bind(WebInspector.runtimeModel));this.prompt.setSuggestBoxEnabled("generic-suggest");this.prompt.renderAsBlock();this.prompt.attach(this.promptElement);this.prompt.proxyElement.addEventListener("keydown",this._promptKeyDown.bind(this),false);this.prompt.setHistoryData(WebInspector.settings.consoleHistory.get());WebInspector.runtimeModel.contextLists().forEach(this._addFrame,this);WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListAdded,this._frameAdded,this);WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListRemoved,this._frameRemoved,this);this._filterStatusMessageElement=document.createElement("div");this._filterStatusMessageElement.classList.add("console-message");this._filterStatusTextElement=this._filterStatusMessageElement.createChild("span","console-info");this._filterStatusMessageElement.createTextChild(" ");var resetFiltersLink=this._filterStatusMessageElement.createChild("span","console-info node-link");resetFiltersLink.textContent=WebInspector.UIString("Show all messages.");resetFiltersLink.addEventListener("click",this._filter.reset.bind(this._filter),true);this.messagesElement.insertBefore(this._filterStatusMessageElement,this.topGroup.element);this._updateFilterStatus();}
2493 WebInspector.ConsoleView.prototype={defaultFocusedElement:function()
2494 {return this.promptElement},_onFiltersToggled:function(event)
2495 {var toggled=(event.data);this._filtersContainer.enableStyleClass("hidden",!toggled);},_frameAdded:function(event)
2496 {var contextList=(event.data);this._addFrame(contextList);},_addFrame:function(contextList)
2497 {var option=this._frameSelector.createOption(contextList.displayName,contextList.url);option._contextList=contextList;contextList._consoleOption=option;contextList.addEventListener(WebInspector.FrameExecutionContextList.EventTypes.ContextsUpdated,this._frameUpdated,this);contextList.addEventListener(WebInspector.FrameExecutionContextList.EventTypes.ContextAdded,this._contextAdded,this);this._frameChanged();},_frameRemoved:function(event)
2498 {var contextList=(event.data);this._frameSelector.removeOption(contextList._consoleOption);this._frameChanged();},_frameChanged:function()
2499 {var context=this._currentFrame();if(!context){WebInspector.runtimeModel.setCurrentExecutionContext(null);this._contextSelector.element.classList.add("hidden");return;}
2500 var executionContexts=context.executionContexts();if(executionContexts.length)
2501 WebInspector.runtimeModel.setCurrentExecutionContext(executionContexts[0]);if(executionContexts.length===1){this._contextSelector.element.classList.add("hidden");return;}
2502 this._contextSelector.element.classList.remove("hidden");this._contextSelector.removeOptions();for(var i=0;i<executionContexts.length;++i)
2503 this._appendContextOption(executionContexts[i]);},_appendContextOption:function(executionContext)
2504 {if(!WebInspector.runtimeModel.currentExecutionContext())
2505 WebInspector.runtimeModel.setCurrentExecutionContext(executionContext);var option=this._contextSelector.createOption(executionContext.name,executionContext.id);option._executionContext=executionContext;},_contextChanged:function()
2506 {var option=this._contextSelector.selectedOption();WebInspector.runtimeModel.setCurrentExecutionContext(option?option._executionContext:null);},_frameUpdated:function(event)
2507 {var contextList=(event.data);var option=contextList._consoleOption;option.text=contextList.displayName;option.title=contextList.url;},_contextAdded:function(event)
2508 {var contextList=(event.data);if(contextList===this._currentFrame())
2509 this._frameChanged();},_currentFrame:function()
2510 {var option=this._frameSelector.selectedOption();return option?option._contextList:undefined;},willHide:function()
2511 {this.prompt.hideSuggestBox();this.prompt.clearAutoComplete(true);},wasShown:function()
2512 {if(!this.prompt.isCaretInsidePrompt())
2513 this.prompt.moveCaretToEndOfPrompt();},focus:function()
2514 {WebInspector.setCurrentFocusElement(this.promptElement);this.prompt.moveCaretToEndOfPrompt();},storeScrollPositions:function()
2515 {WebInspector.View.prototype.storeScrollPositions.call(this);this._scrolledToBottom=this.messagesElement.isScrolledToBottom();},restoreScrollPositions:function()
2516 {if(this._scrolledToBottom)
2517 this._immediatelyScrollIntoView();else
2518 WebInspector.View.prototype.restoreScrollPositions.call(this);},onResize:function()
2519 {this.restoreScrollPositions();},_isScrollIntoViewScheduled:function()
2520 {return!!this._scrollIntoViewTimer;},_scheduleScrollIntoView:function()
2521 {if(this._scrollIntoViewTimer)
2522 return;function scrollIntoView()
2523 {delete this._scrollIntoViewTimer;this.messagesElement.scrollTop=this.messagesElement.scrollHeight-this.messagesElement.clientHeight;}
2524 this._scrollIntoViewTimer=setTimeout(scrollIntoView.bind(this),20);},_immediatelyScrollIntoView:function()
2525 {this.promptElement.scrollIntoView(true);this._cancelScheduledScrollIntoView();},_cancelScheduledScrollIntoView:function()
2526 {if(!this._isScrollIntoViewScheduled())
2527 return;clearTimeout(this._scrollIntoViewTimer);delete this._scrollIntoViewTimer;},_updateFilterStatus:function(count){count=(typeof count==="undefined")?(WebInspector.console.messages.length-this._visibleMessagesIndices.length):count;this._filterStatusTextElement.textContent=WebInspector.UIString(count==1?"%d message is hidden by filters.":"%d messages are hidden by filters.",count);this._filterStatusMessageElement.style.display=count?"":"none";},_consoleMessageAdded:function(event)
2528 {var message=(event.data);var index=message.index;if(this._urlToMessageCount[message.url])
2529 this._urlToMessageCount[message.url]++;else
2530 this._urlToMessageCount[message.url]=1;if(this._filter.shouldBeVisible(message))
2531 this._showConsoleMessage(index);else
2532 this._updateFilterStatus();},_showConsoleMessage:function(index)
2533 {var message=WebInspector.console.messages[index];if(!this._isScrollIntoViewScheduled()&&((message instanceof WebInspector.ConsoleCommandResult)||this.messagesElement.isScrolledToBottom()))
2534 this._scheduleScrollIntoView();this._visibleMessagesIndices.push(index);if(message.type===WebInspector.ConsoleMessage.MessageType.EndGroup){var parentGroup=this.currentGroup.parentGroup;if(parentGroup)
2535 this.currentGroup=parentGroup;}else{if(message.type===WebInspector.ConsoleMessage.MessageType.StartGroup||message.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed){var group=new WebInspector.ConsoleGroup(this.currentGroup);this.currentGroup.messagesElement.appendChild(group.element);this.currentGroup=group;message.group=group;}
2536 this.currentGroup.addMessage(message);}
2537 if(this._searchRegex&&message.matchesRegex(this._searchRegex)){this._searchResultsIndices.push(index);this._searchableView.updateSearchMatchesCount(this._searchResultsIndices.length);}},_consoleCleared:function()
2538 {this._scrolledToBottom=true;for(var i=0;i<this._visibleMessagesIndices.length;++i)
2539 WebInspector.console.messages[this._visibleMessagesIndices[i]].willHide();this._visibleMessagesIndices=[];this._searchResultsIndices=[];if(this._searchRegex)
2540 this._searchableView.updateSearchMatchesCount(0);this.currentGroup=this.topGroup;this.topGroup.messagesElement.removeChildren();this._clearCurrentSearchResultHighlight();this._updateFilterStatus(0);this._linkifier.reset();},_handleContextMenuEvent:function(event)
2541 {if(event.target.enclosingNodeOrSelfWithNodeName("a"))
2542 return;var contextMenu=new WebInspector.ContextMenu(event);function monitoringXHRItemAction()
2543 {WebInspector.settings.monitoringXHREnabled.set(!WebInspector.settings.monitoringXHREnabled.get());}
2544 contextMenu.appendCheckboxItem(WebInspector.UIString("Log XMLHttpRequests"),monitoringXHRItemAction.bind(this),WebInspector.settings.monitoringXHREnabled.get());function preserveLogItemAction()
2545 {WebInspector.settings.preserveConsoleLog.set(!WebInspector.settings.preserveConsoleLog.get());}
2546 contextMenu.appendCheckboxItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Preserve log upon navigation":"Preserve Log upon Navigation"),preserveLogItemAction.bind(this),WebInspector.settings.preserveConsoleLog.get());var sourceElement=event.target.enclosingNodeOrSelfWithClass("console-message");var filterSubMenu=contextMenu.appendSubMenuItem(WebInspector.UIString("Filter"));if(sourceElement&&sourceElement.message.url){var menuTitle=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Hide messages from %s":"Hide Messages from %s",new WebInspector.ParsedURL(sourceElement.message.url).displayName);filterSubMenu.appendItem(menuTitle,this._filter.addMessageURLFilter.bind(this._filter,sourceElement.message.url));}
2547 filterSubMenu.appendSeparator();var unhideAll=filterSubMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Unhide all":"Unhide All"),this._filter.removeMessageURLFilter.bind(this._filter));filterSubMenu.appendSeparator();var hasFilters=false;for(var url in this._filter.messageURLFilters){filterSubMenu.appendCheckboxItem(String.sprintf("%s (%d)",new WebInspector.ParsedURL(url).displayName,this._urlToMessageCount[url]),this._filter.removeMessageURLFilter.bind(this._filter,url),true);hasFilters=true;}
2548 filterSubMenu.setEnabled(hasFilters||(sourceElement&&sourceElement.message.url));unhideAll.setEnabled(hasFilters);contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Clear console":"Clear Console"),this._requestClearMessages.bind(this));var request=(sourceElement&&sourceElement.message)?sourceElement.message.request():null;if(request&&request.type===WebInspector.resourceTypes.XHR){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Replay XHR"),NetworkAgent.replayXHR.bind(null,request.requestId));}
2549 contextMenu.show();},_updateMessageList:function()
2550 {var group=this.topGroup;var sourceMessages=WebInspector.console.messages;var visibleMessageIndex=0;var newVisibleMessages=[];if(this._searchRegex)
2551 this._searchResultsIndices=[];var anchor=null;for(var i=0;i<sourceMessages.length;++i){var sourceMessage=sourceMessages[i];var visibleMessage=WebInspector.console.messages[this._visibleMessagesIndices[visibleMessageIndex]];if(visibleMessage===sourceMessage){if(this._filter.shouldBeVisible(visibleMessage)){newVisibleMessages.push(this._visibleMessagesIndices[visibleMessageIndex]);if(this._searchRegex&&sourceMessage.matchesRegex(this._searchRegex))
2552 this._searchResultsIndices.push(i);if(sourceMessage.type===WebInspector.ConsoleMessage.MessageType.EndGroup){anchor=group.element;group=group.parentGroup||group;}else if(sourceMessage.type===WebInspector.ConsoleMessage.MessageType.StartGroup||sourceMessage.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed){group=sourceMessage.group;anchor=group.messagesElement.firstChild;}else
2553 anchor=visibleMessage.toMessageElement();}else{visibleMessage.willHide();visibleMessage.toMessageElement().remove();}
2554 ++visibleMessageIndex;}else{if(this._filter.shouldBeVisible(sourceMessage)){if(this._searchRegex&&sourceMessage.matchesRegex(this._searchRegex))
2555 this._searchResultsIndices.push(i);group.addMessage(sourceMessage,anchor?anchor.nextSibling:group.messagesElement.firstChild);newVisibleMessages.push(i);anchor=sourceMessage.toMessageElement();}}}
2556 if(this._searchRegex)
2557 this._searchableView.updateSearchMatchesCount(this._searchResultsIndices.length);this._visibleMessagesIndices=newVisibleMessages;this._updateFilterStatus();},_monitoringXHREnabledSettingChanged:function(event)
2558 {ConsoleAgent.setMonitoringXHREnabled(event.data);},_messagesClicked:function()
2559 {if(!this.prompt.isCaretInsidePrompt()&&window.getSelection().isCollapsed)
2560 this.prompt.moveCaretToEndOfPrompt();},_registerShortcuts:function()
2561 {this._shortcuts={};var shortcut=WebInspector.KeyboardShortcut;var section=WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));var shortcutL=shortcut.makeDescriptor("l",WebInspector.KeyboardShortcut.Modifiers.Ctrl);this._shortcuts[shortcutL.key]=this._requestClearMessages.bind(this);var keys=[shortcutL];if(WebInspector.isMac()){var shortcutK=shortcut.makeDescriptor("k",WebInspector.KeyboardShortcut.Modifiers.Meta);this._shortcuts[shortcutK.key]=this._requestClearMessages.bind(this);keys.unshift(shortcutK);}
2562 section.addAlternateKeys(keys,WebInspector.UIString("Clear console"));section.addKey(shortcut.makeDescriptor(shortcut.Keys.Tab),WebInspector.UIString("Autocomplete common prefix"));section.addKey(shortcut.makeDescriptor(shortcut.Keys.Right),WebInspector.UIString("Accept suggestion"));keys=[shortcut.makeDescriptor(shortcut.Keys.Down),shortcut.makeDescriptor(shortcut.Keys.Up)];section.addRelatedKeys(keys,WebInspector.UIString("Next/previous line"));if(WebInspector.isMac()){keys=[shortcut.makeDescriptor("N",shortcut.Modifiers.Alt),shortcut.makeDescriptor("P",shortcut.Modifiers.Alt)];section.addRelatedKeys(keys,WebInspector.UIString("Next/previous command"));}
2563 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Enter),WebInspector.UIString("Execute command"));},_requestClearMessages:function()
2564 {WebInspector.console.requestClearMessages();},_promptKeyDown:function(event)
2565 {if(isEnterKey(event)){this._enterKeyPressed(event);return;}
2566 var shortcut=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcut];if(handler){handler();event.preventDefault();}},evaluateUsingTextPrompt:function(expression,showResultOnly)
2567 {this._appendCommand(expression,this.prompt.text,false,showResultOnly);},_enterKeyPressed:function(event)
2568 {if(event.altKey||event.ctrlKey||event.shiftKey)
2569 return;event.consume(true);this.prompt.clearAutoComplete(true);var str=this.prompt.text;if(!str.length)
2570 return;this._appendCommand(str,"",true,false);},_printResult:function(result,wasThrown,originatingCommand)
2571 {if(!result)
2572 return;function addMessage(url,lineNumber,columnNumber)
2573 {var message=new WebInspector.ConsoleCommandResult(result,wasThrown,originatingCommand,this._linkifier,url,lineNumber,columnNumber);WebInspector.console.addMessage(message);}
2574 if(result.type!=="function"){addMessage.call(this);return;}
2575 DebuggerAgent.getFunctionDetails(result.objectId,didGetDetails.bind(this));function didGetDetails(error,response)
2576 {if(error){console.error(error);addMessage.call(this);return;}
2577 var url;var lineNumber;var columnNumber;var script=WebInspector.debuggerModel.scriptForId(response.location.scriptId);if(script&&script.sourceURL){url=script.sourceURL;lineNumber=response.location.lineNumber+1;columnNumber=response.location.columnNumber+1;}
2578 addMessage.call(this,url,lineNumber,columnNumber);}},_appendCommand:function(text,newPromptText,useCommandLineAPI,showResultOnly)
2579 {if(!showResultOnly){var commandMessage=new WebInspector.ConsoleCommand(text);WebInspector.console.addMessage(commandMessage);}
2580 this.prompt.text=newPromptText;function printResult(result,wasThrown,valueResult)
2581 {if(!result)
2582 return;if(!showResultOnly){this.prompt.pushHistoryItem(text);WebInspector.settings.consoleHistory.set(this.prompt.historyData.slice(-30));}
2583 this._printResult(result,wasThrown,commandMessage);}
2584 WebInspector.runtimeModel.evaluate(text,"console",useCommandLineAPI,false,false,true,printResult.bind(this));WebInspector.userMetrics.ConsoleEvaluated.record();},elementsToRestoreScrollPositionsFor:function()
2585 {return[this.messagesElement];},searchCanceled:function()
2586 {this._clearCurrentSearchResultHighlight();delete this._searchResultsIndices;delete this._searchRegex;},performSearch:function(query,shouldJump)
2587 {this.searchCanceled();this._searchableView.updateSearchMatchesCount(0);this._searchRegex=createPlainTextSearchRegex(query,"gi");this._searchResultsIndices=[];for(var i=0;i<this._visibleMessagesIndices.length;i++){if(WebInspector.console.messages[this._visibleMessagesIndices[i]].matchesRegex(this._searchRegex))
2588 this._searchResultsIndices.push(this._visibleMessagesIndices[i]);}
2589 this._searchableView.updateSearchMatchesCount(this._searchResultsIndices.length);this._currentSearchResultIndex=-1;if(shouldJump&&this._searchResultsIndices.length)
2590 this._jumpToSearchResult(0);},jumpToNextSearchResult:function()
2591 {if(!this._searchResultsIndices||!this._searchResultsIndices.length)
2592 return;this._jumpToSearchResult((this._currentSearchResultIndex+1)%this._searchResultsIndices.length);},jumpToPreviousSearchResult:function()
2593 {if(!this._searchResultsIndices||!this._searchResultsIndices.length)
2594 return;var index=this._currentSearchResultIndex-1;if(index===-1)
2595 index=this._searchResultsIndices.length-1;this._jumpToSearchResult(index);},_clearCurrentSearchResultHighlight:function()
2596 {if(!this._searchResultsIndices)
2597 return;var highlightedMessage=WebInspector.console.messages[this._searchResultsIndices[this._currentSearchResultIndex]];if(highlightedMessage)
2598 highlightedMessage.clearHighlight();this._currentSearchResultIndex=-1;},_jumpToSearchResult:function(index)
2599 {this._clearCurrentSearchResultHighlight();this._currentSearchResultIndex=index;this._searchableView.updateCurrentMatchIndex(this._currentSearchResultIndex);WebInspector.console.messages[this._searchResultsIndices[index]].highlightSearchResults(this._searchRegex);},__proto__:WebInspector.View.prototype}
2600 WebInspector.ConsoleViewFilter=function()
2601 {this._messageURLFilters=WebInspector.settings.messageURLFilters.get();this._filterChanged=this.dispatchEventToListeners.bind(this,WebInspector.ConsoleViewFilter.Events.FilterChanged);};WebInspector.ConsoleViewFilter.Events={FilterChanged:"FilterChanged"};WebInspector.ConsoleViewFilter.prototype={addFilters:function(filterBar)
2602 {this._textFilterUI=new WebInspector.TextFilterUI(true);this._textFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._textFilterChanged,this);filterBar.addFilter(this._textFilterUI);this._levelFilterUI=new WebInspector.NamedBitSetFilterUI();this._levelFilterUI.addBit("error",WebInspector.UIString("Errors"));this._levelFilterUI.addBit("warning",WebInspector.UIString("Warnings"));this._levelFilterUI.addBit("info",WebInspector.UIString("Info"));this._levelFilterUI.addBit("log",WebInspector.UIString("Logs"));this._levelFilterUI.addBit("debug",WebInspector.UIString("Debug"));this._levelFilterUI.bindSetting(WebInspector.settings.messageLevelFilters);this._levelFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._filterChanged,this);filterBar.addFilter(this._levelFilterUI);},_textFilterChanged:function(event)
2603 {this._filterRegex=this._textFilterUI.regex();this._filterChanged();},addMessageURLFilter:function(url)
2604 {this._messageURLFilters[url]=true;WebInspector.settings.messageURLFilters.set(this._messageURLFilters);this._filterChanged();},removeMessageURLFilter:function(url)
2605 {if(!url)
2606 this._messageURLFilters={};else
2607 delete this._messageURLFilters[url];WebInspector.settings.messageURLFilters.set(this._messageURLFilters);this._filterChanged();},get messageURLFilters()
2608 {return this._messageURLFilters;},shouldBeVisible:function(message)
2609 {if((message.type===WebInspector.ConsoleMessage.MessageType.StartGroup||message.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed||message.type===WebInspector.ConsoleMessage.MessageType.EndGroup))
2610 return true;if(message.type===WebInspector.ConsoleMessage.MessageType.Result||message.type===WebInspector.ConsoleMessage.MessageType.Command)
2611 return true;if(message.url&&this._messageURLFilters[message.url])
2612 return false;if(message.level&&!this._levelFilterUI.accept(message.level))
2613 return false;if(this._filterRegex){this._filterRegex.lastIndex=0;if(!message.matchesRegex(this._filterRegex))
2614 return false;}
2615 return true;},reset:function()
2616 {this._messageURLFilters={};WebInspector.settings.messageURLFilters.set(this._messageURLFilters);WebInspector.settings.messageLevelFilters.set({});this._filterChanged();},__proto__:WebInspector.Object.prototype};WebInspector.ConsoleCommand=function(text)
2617 {this.text=text;this.type=WebInspector.ConsoleMessage.MessageType.Command;}
2618 WebInspector.ConsoleCommand.prototype={wasShown:function()
2619 {},willHide:function()
2620 {},clearHighlight:function()
2621 {var highlightedMessage=this._formattedCommand;delete this._formattedCommand;this._formatCommand();this._element.replaceChild(this._formattedCommand,highlightedMessage);},highlightSearchResults:function(regexObject)
2622 {regexObject.lastIndex=0;var match=regexObject.exec(this.text);var matchRanges=[];while(match){matchRanges.push(new WebInspector.SourceRange(match.index,match[0].length));match=regexObject.exec(this.text);}
2623 WebInspector.highlightSearchResults(this._formattedCommand,matchRanges);this._element.scrollIntoViewIfNeeded();},matchesRegex:function(regexObject)
2624 {regexObject.lastIndex=0;return regexObject.test(this.text);},toMessageElement:function()
2625 {if(!this._element){this._element=document.createElement("div");this._element.command=this;this._element.className="console-user-command";this._formatCommand();this._element.appendChild(this._formattedCommand);}
2626 return this._element;},_formatCommand:function()
2627 {this._formattedCommand=document.createElement("span");this._formattedCommand.className="console-message-text source-code";this._formattedCommand.textContent=this.text;},__proto__:WebInspector.ConsoleMessage.prototype}
2628 WebInspector.ConsoleCommandResult=function(result,wasThrown,originatingCommand,linkifier,url,lineNumber,columnNumber)
2629 {var level=(wasThrown?WebInspector.ConsoleMessage.MessageLevel.Error:WebInspector.ConsoleMessage.MessageLevel.Log);this.originatingCommand=originatingCommand;WebInspector.ConsoleMessageImpl.call(this,WebInspector.ConsoleMessage.MessageSource.JS,level,"",linkifier,WebInspector.ConsoleMessage.MessageType.Result,url,lineNumber,columnNumber,undefined,[result]);}
2630 WebInspector.ConsoleCommandResult.prototype={useArrayPreviewInFormatter:function(array)
2631 {return false;},toMessageElement:function()
2632 {var element=WebInspector.ConsoleMessageImpl.prototype.toMessageElement.call(this);element.classList.add("console-user-command-result");return element;},__proto__:WebInspector.ConsoleMessageImpl.prototype}
2633 WebInspector.ConsoleGroup=function(parentGroup)
2634 {this.parentGroup=parentGroup;var element=document.createElement("div");element.className="console-group";element.group=this;this.element=element;if(parentGroup){var bracketElement=document.createElement("div");bracketElement.className="console-group-bracket";element.appendChild(bracketElement);}
2635 var messagesElement=document.createElement("div");messagesElement.className="console-group-messages";element.appendChild(messagesElement);this.messagesElement=messagesElement;}
2636 WebInspector.ConsoleGroup.prototype={addMessage:function(message,node)
2637 {var element=message.toMessageElement();if(message.type===WebInspector.ConsoleMessage.MessageType.StartGroup||message.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed){this.messagesElement.parentNode.insertBefore(element,this.messagesElement);element.addEventListener("click",this._titleClicked.bind(this),false);var groupElement=element.enclosingNodeOrSelfWithClass("console-group");if(groupElement&&message.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
2638 groupElement.classList.add("collapsed");}else{this.messagesElement.insertBefore(element,node||null);message.wasShown();}
2639 if(element.previousSibling&&message.originatingCommand&&element.previousSibling.command===message.originatingCommand)
2640 element.previousSibling.classList.add("console-adjacent-user-command-result");},_titleClicked:function(event)
2641 {var groupTitleElement=event.target.enclosingNodeOrSelfWithClass("console-group-title");if(groupTitleElement){var groupElement=groupTitleElement.enclosingNodeOrSelfWithClass("console-group");if(groupElement&&!groupElement.classList.toggle("collapsed")){if(groupElement.group){groupElement.group.wasShown();}}
2642 groupTitleElement.scrollIntoViewIfNeeded(true);}
2643 event.consume(true);},wasShown:function()
2644 {if(this.element.classList.contains("collapsed"))
2645 return;var node=this.messagesElement.firstChild;while(node){if(node.classList.contains("console-message")&&node.message)
2646 node.message.wasShown();if(node.classList.contains("console-group")&&node.group)
2647 node.group.wasShown();node=node.nextSibling;}}}
2648 WebInspector.consoleView;WebInspector.ConsoleMessage.create=function(source,level,message,type,url,line,column,repeatCount,parameters,stackTrace,requestId,isOutdated)
2649 {return new WebInspector.ConsoleMessageImpl(source,level,message,WebInspector.consoleView._linkifier,type,url,line,column,repeatCount,parameters,stackTrace,requestId,isOutdated);}
2650 WebInspector.Panel=function(name)
2651 {WebInspector.View.call(this);WebInspector.panels[name]=this;this.element.classList.add("panel");this.element.classList.add(name);this._panelName=name;this._shortcuts=({});WebInspector.settings[this._sidebarWidthSettingName()]=WebInspector.settings.createSetting(this._sidebarWidthSettingName(),undefined);}
2652 WebInspector.Panel.counterRightMargin=25;WebInspector.Panel.prototype={get name()
2653 {return this._panelName;},reset:function()
2654 {},defaultFocusedElement:function()
2655 {return this.sidebarTreeElement||this.element;},searchableView:function()
2656 {return null;},replaceSelectionWith:function(text)
2657 {},replaceAllWith:function(query,text)
2658 {},createSidebarView:function(parentElement,position,defaultWidth,defaultHeight)
2659 {if(this.splitView)
2660 return;if(!parentElement)
2661 parentElement=this.element;this.splitView=new WebInspector.SidebarView(position,this._sidebarWidthSettingName(),defaultWidth,defaultHeight);this.splitView.show(parentElement);this.splitView.addEventListener(WebInspector.SidebarView.EventTypes.Resized,this.sidebarResized.bind(this));},createSidebarViewWithTree:function(parentElement,position,defaultWidth)
2662 {if(this.splitView)
2663 return;this.createSidebarView(parentElement,position);this.sidebarTreeElement=document.createElement("ol");this.sidebarTreeElement.className="sidebar-tree";this.splitView.sidebarElement().appendChild(this.sidebarTreeElement);this.splitView.sidebarElement().classList.add("sidebar");this.sidebarTree=new TreeOutline(this.sidebarTreeElement);this.sidebarTree.panel=this;},_sidebarWidthSettingName:function()
2664 {return this._panelName+"SidebarWidth";},get statusBarItems()
2665 {},sidebarResized:function(event)
2666 {},statusBarResized:function()
2667 {},showAnchorLocation:function(anchor)
2668 {return false;},elementsToRestoreScrollPositionsFor:function()
2669 {return[];},handleShortcut:function(event)
2670 {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcutKey];if(handler&&handler(event)){event.handled=true;return;}
2671 var searchableView=this.searchableView();if(!searchableView)
2672 return;function handleSearchShortcuts(shortcuts,handler)
2673 {for(var i=0;i<shortcuts.length;++i){if(shortcuts[i].key!==shortcutKey)
2674 continue;return handler.call(searchableView);}
2675 return false;}
2676 if(handleSearchShortcuts(WebInspector.SearchableView.findShortcuts(),searchableView.handleFindShortcut))
2677 event.handled=true;else if(handleSearchShortcuts(WebInspector.SearchableView.cancelSearchShortcuts(),searchableView.handleCancelSearchShortcut))
2678 event.handled=true;},registerShortcuts:function(keys,handler)
2679 {for(var i=0;i<keys.length;++i)
2680 this._shortcuts[keys[i].key]=handler;},__proto__:WebInspector.View.prototype}
2681 WebInspector.PanelDescriptor=function()
2682 {}
2683 WebInspector.PanelDescriptor.prototype={name:function(){},title:function(){},panel:function(){}}
2684 WebInspector.ModuleManagerExtensionPanelDescriptor=function(extension)
2685 {this._name=extension.descriptor()["name"];this._title=WebInspector.UIString(extension.descriptor()["title"]);this._extension=extension;}
2686 WebInspector.ModuleManagerExtensionPanelDescriptor.prototype={name:function()
2687 {return this._name;},title:function()
2688 {return this._title;},panel:function()
2689 {return(this._extension.instance());}}
2690 WebInspector.InspectorView=function()
2691 {WebInspector.View.call(this);this.markAsRoot();this.element.classList.add("fill","vbox","inspector-view");this.element.setAttribute("spellcheck",false);var settingName=WebInspector.queryParamsObject["can_dock"]?"InspectorView.splitView":"InspectorView.screencastSplitView";this._splitView=new WebInspector.SplitView(false,settingName,300,300);this._splitView.setSecondIsSidebar(true);this._updateConstraints();WebInspector.dockController.addEventListener(WebInspector.DockController.Events.DockSideChanged,this._updateSplitView.bind(this));this._splitView.element.id="inspector-split-view";this._splitView.show(this.element);this._overlayView=new WebInspector.ViewWithResizeCallback(this._onOverlayResized.bind(this));this._splitView.setMainView(this._overlayView);this._zoomFactor=WebInspector.zoomFactor();WebInspector.settings.zoomLevel.addChangeListener(this._onZoomChanged,this);this._devtoolsElement=this._splitView.sidebarElement();this._devtoolsElement.classList.add("vbox");this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.setRetainTabOrder(true,WebInspector.moduleManager.orderComparator(WebInspector.Panel,"name","order"));this._splitView.setSidebarView(this._tabbedPane);this._toolbarElement=document.createElement("div");this._toolbarElement.className="toolbar toolbar-background";var headerElement=this._tabbedPane.headerElement();headerElement.parentElement.insertBefore(this._toolbarElement,headerElement);this._leftToolbarElement=this._toolbarElement.createChild("div","toolbar-controls-left");this._toolbarElement.appendChild(headerElement);this._rightToolbarElement=this._toolbarElement.createChild("div","toolbar-controls-right");this._errorWarningCountElement=this._rightToolbarElement.createChild("div","hidden");this._errorWarningCountElement.id="error-warning-count";this._closeButtonToolbarItem=document.createElementWithClass("div","toolbar-close-button-item");var closeButtonElement=this._closeButtonToolbarItem.createChild("div","close-button");closeButtonElement.addEventListener("click",WebInspector.close.bind(WebInspector),true);this._rightToolbarElement.appendChild(this._closeButtonToolbarItem);this._drawer=new WebInspector.Drawer(this);this.appendToRightToolbar(this._drawer.toggleButtonElement());this._history=[];this._historyIterator=-1;document.addEventListener("keydown",this._keyDown.bind(this),false);document.addEventListener("keypress",this._keyPress.bind(this),false);this._panelDescriptors={};this._openBracketIdentifiers=["U+005B","U+00DB"].keySet();this._closeBracketIdentifiers=["U+005D","U+00DD"].keySet();this._lastActivePanelSetting=WebInspector.settings.createSetting("lastActivePanel","elements");this._updateSplitView();this._initialize();}
2692 WebInspector.InspectorView.Constraints={OverlayWidth:50,OverlayHeight:50,DevToolsWidth:150,DevToolsHeight:50};WebInspector.InspectorView.prototype={_initialize:function()
2693 {WebInspector.startBatchUpdate();WebInspector.moduleManager.extensions(WebInspector.Panel).forEach(processPanelExtensions.bind(this));function processPanelExtensions(extension)
2694 {this.addPanel(new WebInspector.ModuleManagerExtensionPanelDescriptor(extension));}
2695 WebInspector.endBatchUpdate();},appendToLeftToolbar:function(element)
2696 {this._leftToolbarElement.appendChild(element);},appendToRightToolbar:function(element)
2697 {this._rightToolbarElement.insertBefore(element,this._closeButtonToolbarItem);},drawer:function()
2698 {return this._drawer;},devtoolsElement:function()
2699 {return this._devtoolsElement;},addPanel:function(panelDescriptor)
2700 {var panelName=panelDescriptor.name();this._panelDescriptors[panelName]=panelDescriptor;this._tabbedPane.appendTab(panelName,panelDescriptor.title(),new WebInspector.View());if(this._lastActivePanelSetting.get()===panelName)
2701 this._tabbedPane.selectTab(panelName);},panel:function(panelName)
2702 {var panelDescriptor=this._panelDescriptors[panelName];var panelOrder=this._tabbedPane.allTabs();if(!panelDescriptor&&panelOrder.length)
2703 panelDescriptor=this._panelDescriptors[panelOrder[0]];return panelDescriptor?panelDescriptor.panel():null;},showPanel:function(panelName)
2704 {var panel=this.panel(panelName);if(panel)
2705 this.setCurrentPanel(panel);return panel;},currentPanel:function()
2706 {return this._currentPanel;},showInitialPanel:function()
2707 {this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);this._tabSelected();this._drawer.showOnLoadIfNecessary();},_tabSelected:function()
2708 {var panelName=this._tabbedPane.selectedTabId;var panel=this._panelDescriptors[this._tabbedPane.selectedTabId].panel();this._tabbedPane.changeTabView(panelName,panel);this._currentPanel=panel;this._lastActivePanelSetting.set(panel.name);this._pushToHistory(panel.name);WebInspector.userMetrics.panelShown(panel.name);panel.focus();},setCurrentPanel:function(x)
2709 {if(this._currentPanel===x)
2710 return;this._tabbedPane.changeTabView(x.name,x);this._tabbedPane.selectTab(x.name);},closeViewInDrawer:function(id)
2711 {this._drawer.closeView(id);},showCloseableViewInDrawer:function(id,title,view)
2712 {this._drawer.showCloseableView(id,title,view);},showViewInDrawer:function(id)
2713 {this._drawer.showView(id);},selectedViewInDrawer:function()
2714 {return this._drawer.selectedViewId();},closeDrawer:function()
2715 {this._drawer.hide();},defaultFocusedElement:function()
2716 {return this._currentPanel?this._currentPanel.defaultFocusedElement():null;},_keyPress:function(event)
2717 {if(event.charCode<32&&WebInspector.isWin())
2718 return;clearTimeout(this._keyDownTimer);delete this._keyDownTimer;},_keyDown:function(event)
2719 {if(!WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event))
2720 return;var keyboardEvent=(event);var panelShortcutEnabled=WebInspector.settings.shortcutPanelSwitch.get();if(panelShortcutEnabled&&!event.shiftKey&&!event.altKey){var panelIndex=-1;if(event.keyCode>0x30&&event.keyCode<0x3A)
2721 panelIndex=event.keyCode-0x31;else if(event.keyCode>0x60&&event.keyCode<0x6A&&keyboardEvent.location===KeyboardEvent.DOM_KEY_LOCATION_NUMPAD)
2722 panelIndex=event.keyCode-0x61;if(panelIndex!==-1){var panelName=this._tabbedPane.allTabs()[panelIndex];if(panelName){this.showPanel(panelName);event.consume(true);}
2723 return;}}
2724 if(!WebInspector.isWin()||(!this._openBracketIdentifiers[event.keyIdentifier]&&!this._closeBracketIdentifiers[event.keyIdentifier])){this._keyDownInternal(event);return;}
2725 this._keyDownTimer=setTimeout(this._keyDownInternal.bind(this,event),0);},_keyDownInternal:function(event)
2726 {if(this._openBracketIdentifiers[event.keyIdentifier]){var isRotateLeft=!event.shiftKey&&!event.altKey;if(isRotateLeft){var panelOrder=this._tabbedPane.allTabs();var index=panelOrder.indexOf(this.currentPanel().name);index=(index===0)?panelOrder.length-1:index-1;this.showPanel(panelOrder[index]);event.consume(true);return;}
2727 var isGoBack=event.altKey;if(isGoBack&&this._canGoBackInHistory()){this._goBackInHistory();event.consume(true);}
2728 return;}
2729 if(this._closeBracketIdentifiers[event.keyIdentifier]){var isRotateRight=!event.shiftKey&&!event.altKey;if(isRotateRight){var panelOrder=this._tabbedPane.allTabs();var index=panelOrder.indexOf(this.currentPanel().name);index=(index+1)%panelOrder.length;this.showPanel(panelOrder[index]);event.consume(true);return;}
2730 var isGoForward=event.altKey;if(isGoForward&&this._canGoForwardInHistory()){this._goForwardInHistory();event.consume(true);}
2731 return;}},_canGoBackInHistory:function()
2732 {return this._historyIterator>0;},_goBackInHistory:function()
2733 {this._inHistory=true;this.setCurrentPanel(WebInspector.panels[this._history[--this._historyIterator]]);delete this._inHistory;},_canGoForwardInHistory:function()
2734 {return this._historyIterator<this._history.length-1;},_goForwardInHistory:function()
2735 {this._inHistory=true;this.setCurrentPanel(WebInspector.panels[this._history[++this._historyIterator]]);delete this._inHistory;},_pushToHistory:function(panelName)
2736 {if(this._inHistory)
2737 return;this._history.splice(this._historyIterator+1,this._history.length-this._historyIterator-1);if(!this._history.length||this._history[this._history.length-1]!==panelName)
2738 this._history.push(panelName);this._historyIterator=this._history.length-1;},onResize:function()
2739 {this.doResize();this._drawer.resize();},_updateSplitView:function()
2740 {var dockSide=WebInspector.dockController.dockSide();if(dockSide!==WebInspector.DockController.State.Undocked){this._splitView.showBoth();var vertical=dockSide===WebInspector.DockController.State.DockedToRight;this._splitView.setVertical(vertical);if(vertical){this._splitView.uninstallResizer(this._tabbedPane.headerElement());this._splitView.installResizer(this._splitView.resizerElement());}else{this._splitView.uninstallResizer(this._splitView.resizerElement());this._splitView.installResizer(this._tabbedPane.headerElement());}}else{this._splitView.showOnlySecond();}},_onOverlayResized:function()
2741 {var dockSide=WebInspector.dockController.dockSide();if(dockSide!==WebInspector.DockController.State.Undocked){if(this._setContentsInsetsId)
2742 window.cancelAnimationFrame(this._setContentsInsetsId);this._setContentsInsetsId=window.requestAnimationFrame(this._setContentsInsets.bind(this));}
2743 this._drawer.resize();},_setContentsInsets:function()
2744 {delete this._setContentsInsetsId;var sidebarSize=Math.ceil(this._splitView.sidebarSize()*WebInspector.zoomFactor());var bottom=this._splitView.isVertical()?0:sidebarSize;var right=this._splitView.isVertical()?sidebarSize+3:0;InspectorFrontendHost.setContentsInsets(0,0,bottom,right);},_onZoomChanged:function()
2745 {this._updateConstraints();var zoomFactor=WebInspector.zoomFactor();if(zoomFactor!==this._zoomFactor)
2746 this._splitView.setSidebarSize(this._splitView.sidebarSize()*this._zoomFactor/zoomFactor,true);this._zoomFactor=zoomFactor;},_updateConstraints:function()
2747 {var zoomFactor=WebInspector.zoomFactor();this._splitView.setSidebarElementConstraints(WebInspector.InspectorView.Constraints.DevToolsWidth/zoomFactor,WebInspector.InspectorView.Constraints.DevToolsHeight/zoomFactor);this._splitView.setMainElementConstraints(WebInspector.InspectorView.Constraints.OverlayWidth/zoomFactor,WebInspector.InspectorView.Constraints.OverlayHeight/zoomFactor);},showScreencastView:function(view,vertical)
2748 {if(view.parentView()!==this._overlayView)
2749 view.show(this._overlayView.element);this._splitView.setVertical(vertical);this._splitView.showBoth();},hideScreencastView:function()
2750 {this._splitView.showOnlySecond();},setErrorAndWarningCounts:function(errors,warnings)
2751 {if(!errors&&!warnings){this._errorWarningCountElement.classList.add("hidden");this._tabbedPane.headerResized();return;}
2752 this._errorWarningCountElement.classList.remove("hidden");this._errorWarningCountElement.removeChildren();if(errors){var errorImageElement=this._errorWarningCountElement.createChild("div","error-icon-small");var errorElement=this._errorWarningCountElement.createChild("span");errorElement.id="error-count";errorElement.textContent=errors;}
2753 if(warnings){var warningsImageElement=this._errorWarningCountElement.createChild("div","warning-icon-small");var warningsElement=this._errorWarningCountElement.createChild("span");warningsElement.id="warning-count";warningsElement.textContent=warnings;}
2754 if(errors){if(warnings){if(errors==1){if(warnings==1)
2755 this._errorWarningCountElement.title=WebInspector.UIString("%d error, %d warning",errors,warnings);else
2756 this._errorWarningCountElement.title=WebInspector.UIString("%d error, %d warnings",errors,warnings);}else if(warnings==1)
2757 this._errorWarningCountElement.title=WebInspector.UIString("%d errors, %d warning",errors,warnings);else
2758 this._errorWarningCountElement.title=WebInspector.UIString("%d errors, %d warnings",errors,warnings);}else if(errors==1)
2759 this._errorWarningCountElement.title=WebInspector.UIString("%d error",errors);else
2760 this._errorWarningCountElement.title=WebInspector.UIString("%d errors",errors);}else if(warnings==1)
2761 this._errorWarningCountElement.title=WebInspector.UIString("%d warning",warnings);else if(warnings)
2762 this._errorWarningCountElement.title=WebInspector.UIString("%d warnings",warnings);else
2763 this._errorWarningCountElement.title=null;this._tabbedPane.headerResized();},__proto__:WebInspector.View.prototype};WebInspector.inspectorView;WebInspector.AdvancedSearchController=function()
2764 {this._shortcut=WebInspector.AdvancedSearchController.createShortcut();this._searchId=0;WebInspector.settings.advancedSearchConfig=WebInspector.settings.createSetting("advancedSearchConfig",new WebInspector.SearchConfig("",true,false));WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,this._frameNavigated,this);}
2765 WebInspector.AdvancedSearchController.createShortcut=function()
2766 {if(WebInspector.isMac())
2767 return WebInspector.KeyboardShortcut.makeDescriptor("f",WebInspector.KeyboardShortcut.Modifiers.Meta|WebInspector.KeyboardShortcut.Modifiers.Alt);else
2768 return WebInspector.KeyboardShortcut.makeDescriptor("f",WebInspector.KeyboardShortcut.Modifiers.Ctrl|WebInspector.KeyboardShortcut.Modifiers.Shift);}
2769 WebInspector.AdvancedSearchController.prototype={handleShortcut:function(event)
2770 {if(WebInspector.KeyboardShortcut.makeKeyFromEvent(event)===this._shortcut.key){if(!this._searchView||!this._searchView.isShowing()||this._searchView._search!==document.activeElement){WebInspector.showPanel("sources");this.show();}else
2771 WebInspector.inspectorView.closeDrawer();event.consume(true);return true;}
2772 return false;},_frameNavigated:function()
2773 {this.resetSearch();},show:function()
2774 {var selection=window.getSelection();var queryCandidate;if(selection.rangeCount)
2775 queryCandidate=selection.toString().replace(/\r?\n.*/,"");if(!this._searchView||!this._searchView.isShowing())
2776 WebInspector.inspectorView.showViewInDrawer("search");if(queryCandidate)
2777 this._searchView._search.value=queryCandidate;this._searchView.focus();this.startIndexing();},_onIndexingFinished:function(finished)
2778 {delete this._isIndexing;this._searchView.indexingFinished(finished);if(!finished)
2779 delete this._pendingSearchConfig;if(!this._pendingSearchConfig)
2780 return;var searchConfig=this._pendingSearchConfig
2781 delete this._pendingSearchConfig;this._innerStartSearch(searchConfig);},startIndexing:function()
2782 {this._isIndexing=true;this._currentSearchScope=this._searchScopes()[0];if(this._progressIndicator)
2783 this._progressIndicator.done();this._progressIndicator=new WebInspector.ProgressIndicator();this._searchView.indexingStarted(this._progressIndicator);this._currentSearchScope.performIndexing(this._progressIndicator,this._onIndexingFinished.bind(this));},_onSearchResult:function(searchId,searchResult)
2784 {if(searchId!==this._searchId)
2785 return;this._searchView.addSearchResult(searchResult);if(!searchResult.searchMatches.length)
2786 return;if(!this._searchResultsPane)
2787 this._searchResultsPane=this._currentSearchScope.createSearchResultsPane(this._searchConfig);this._searchView.resultsPane=this._searchResultsPane;this._searchResultsPane.addSearchResult(searchResult);},_onSearchFinished:function(searchId,finished)
2788 {if(searchId!==this._searchId)
2789 return;if(!this._searchResultsPane)
2790 this._searchView.nothingFound();this._searchView.searchFinished(finished);delete this._searchConfig;},startSearch:function(searchConfig)
2791 {this.resetSearch();++this._searchId;if(!this._isIndexing)
2792 this.startIndexing();this._pendingSearchConfig=searchConfig;},_innerStartSearch:function(searchConfig)
2793 {this._searchConfig=searchConfig;this._currentSearchScope=this._searchScopes()[0];if(this._progressIndicator)
2794 this._progressIndicator.done();this._progressIndicator=new WebInspector.ProgressIndicator();this._searchView.searchStarted(this._progressIndicator);this._currentSearchScope.performSearch(searchConfig,this._progressIndicator,this._onSearchResult.bind(this,this._searchId),this._onSearchFinished.bind(this,this._searchId));},resetSearch:function()
2795 {this.stopSearch();if(this._searchResultsPane){this._searchView.resetResults();delete this._searchResultsPane;}},stopSearch:function()
2796 {if(this._progressIndicator)
2797 this._progressIndicator.cancel();if(this._currentSearchScope)
2798 this._currentSearchScope.stopSearch();delete this._searchConfig;},_searchScopes:function()
2799 {return(WebInspector.moduleManager.instances(WebInspector.SearchScope));}}
2800 WebInspector.AdvancedSearchController.ViewFactory=function()
2801 {}
2802 WebInspector.AdvancedSearchController.ViewFactory.prototype={createView:function()
2803 {if(!WebInspector.advancedSearchController._searchView)
2804 WebInspector.advancedSearchController._searchView=new WebInspector.SearchView(WebInspector.advancedSearchController);return WebInspector.advancedSearchController._searchView;}}
2805 WebInspector.SearchView=function(controller)
2806 {WebInspector.View.call(this);this._controller=controller;this.element.className="search-view vbox";this._searchPanelElement=this.element.createChild("div","search-drawer-header");this._searchPanelElement.addEventListener("keydown",this._onKeyDown.bind(this),false);this._searchResultsElement=this.element.createChild("div");this._searchResultsElement.className="search-results";this._search=this._searchPanelElement.createChild("input");this._search.placeholder=WebInspector.UIString("Search sources");this._search.setAttribute("type","text");this._search.classList.add("search-config-search");this._search.setAttribute("results","0");this._search.setAttribute("size",30);this._ignoreCaseLabel=this._searchPanelElement.createChild("label");this._ignoreCaseLabel.classList.add("search-config-label");this._ignoreCaseCheckbox=this._ignoreCaseLabel.createChild("input");this._ignoreCaseCheckbox.setAttribute("type","checkbox");this._ignoreCaseCheckbox.classList.add("search-config-checkbox");this._ignoreCaseLabel.appendChild(document.createTextNode(WebInspector.UIString("Ignore case")));this._regexLabel=this._searchPanelElement.createChild("label");this._regexLabel.classList.add("search-config-label");this._regexCheckbox=this._regexLabel.createChild("input");this._regexCheckbox.setAttribute("type","checkbox");this._regexCheckbox.classList.add("search-config-checkbox");this._regexLabel.appendChild(document.createTextNode(WebInspector.UIString("Regular expression")));this._searchStatusBarElement=this.element.createChild("div","search-status-bar-summary");this._searchMessageElement=this._searchStatusBarElement.createChild("span");this._searchResultsMessageElement=document.createElement("span");this._load();}
2807 WebInspector.SearchView.maxQueriesCount=20;WebInspector.SearchView.prototype={get searchConfig()
2808 {return new WebInspector.SearchConfig(this._search.value,this._ignoreCaseCheckbox.checked,this._regexCheckbox.checked);},set resultsPane(resultsPane)
2809 {this.resetResults();this._searchResultsElement.appendChild(resultsPane.element);},searchStarted:function(progressIndicator)
2810 {this.resetResults();this._resetCounters();this._searchMessageElement.textContent=WebInspector.UIString("Searching...");progressIndicator.show(this._searchStatusBarElement);this._updateSearchResultsMessage();if(!this._searchingView)
2811 this._searchingView=new WebInspector.EmptyView(WebInspector.UIString("Searching..."));this._searchingView.show(this._searchResultsElement);},indexingStarted:function(progressIndicator)
2812 {this._searchMessageElement.textContent=WebInspector.UIString("Indexing...");progressIndicator.show(this._searchStatusBarElement);},indexingFinished:function(finished)
2813 {this._searchMessageElement.textContent=finished?"":WebInspector.UIString("Indexing interrupted.");},_updateSearchResultsMessage:function()
2814 {if(this._searchMatchesCount&&this._searchResultsCount)
2815 this._searchResultsMessageElement.textContent=WebInspector.UIString("Found %d matches in %d files.",this._searchMatchesCount,this._nonEmptySearchResultsCount);else
2816 this._searchResultsMessageElement.textContent="";},resetResults:function()
2817 {if(this._searchingView)
2818 this._searchingView.detach();if(this._notFoundView)
2819 this._notFoundView.detach();this._searchResultsElement.removeChildren();},_resetCounters:function()
2820 {this._searchMatchesCount=0;this._searchResultsCount=0;this._nonEmptySearchResultsCount=0;},nothingFound:function()
2821 {this.resetResults();if(!this._notFoundView)
2822 this._notFoundView=new WebInspector.EmptyView(WebInspector.UIString("No matches found."));this._notFoundView.show(this._searchResultsElement);this._searchResultsMessageElement.textContent=WebInspector.UIString("No matches found.");},addSearchResult:function(searchResult)
2823 {this._searchMatchesCount+=searchResult.searchMatches.length;this._searchResultsCount++;if(searchResult.searchMatches.length)
2824 this._nonEmptySearchResultsCount++;this._updateSearchResultsMessage();},searchFinished:function(finished)
2825 {this._searchMessageElement.textContent=finished?WebInspector.UIString("Search finished."):WebInspector.UIString("Search interrupted.");},focus:function()
2826 {WebInspector.setCurrentFocusElement(this._search);this._search.select();},willHide:function()
2827 {this._controller.stopSearch();},_onKeyDown:function(event)
2828 {switch(event.keyCode){case WebInspector.KeyboardShortcut.Keys.Enter.code:this._onAction();break;}},_save:function()
2829 {WebInspector.settings.advancedSearchConfig.set(this.searchConfig);},_load:function()
2830 {var searchConfig=WebInspector.settings.advancedSearchConfig.get();this._search.value=searchConfig.query;this._ignoreCaseCheckbox.checked=searchConfig.ignoreCase;this._regexCheckbox.checked=searchConfig.isRegex;},_onAction:function()
2831 {var searchConfig=this.searchConfig;if(!searchConfig.query||!searchConfig.query.length)
2832 return;this._save();this._controller.startSearch(searchConfig);},__proto__:WebInspector.View.prototype}
2833 WebInspector.SearchConfig=function(query,ignoreCase,isRegex)
2834 {this.query=query;this.ignoreCase=ignoreCase;this.isRegex=isRegex;this._parse();}
2835 WebInspector.SearchConfig.prototype={_parse:function()
2836 {var filePattern="file:(([^\\\\ ]|\\\\.)+)";var quotedPattern="\"(([^\\\\\"]|\\\\.)+)\"";var unquotedPattern="(([^\\\\ ]|\\\\.)+)";var pattern="("+filePattern+")|("+quotedPattern+")|("+unquotedPattern+")";var regexp=new RegExp(pattern,"g");var queryParts=this.query.match(regexp)||[];this._fileQueries=[];this._queries=[];for(var i=0;i<queryParts.length;++i){var queryPart=queryParts[i];if(!queryPart)
2837 continue;if(queryPart.startsWith("file:")){this._fileQueries.push(this._parseFileQuery(queryPart));continue;}
2838 if(queryPart.startsWith("\"")){if(!queryPart.endsWith("\""))
2839 continue;this._queries.push(this._parseQuotedQuery(queryPart));continue;}
2840 this._queries.push(this._parseUnquotedQuery(queryPart));}},fileQueries:function()
2841 {return this._fileQueries;},queries:function()
2842 {return this._queries;},_parseUnquotedQuery:function(query)
2843 {return query.replace(/\\(.)/g,"$1");},_parseQuotedQuery:function(query)
2844 {return query.substring(1,query.length-1).replace(/\\(.)/g,"$1");},_parseFileQuery:function(query)
2845 {query=query.substr("file:".length);var result="";for(var i=0;i<query.length;++i){var char=query[i];if(char==="*"){result+=".*";}else if(char==="\\"){++i;var nextChar=query[i];if(nextChar===" ")
2846 result+=" ";}else{if(String.regexSpecialCharacters().indexOf(query.charAt(i))!==-1)
2847 result+="\\";result+=query.charAt(i);}}
2848 return result;}}
2849 WebInspector.SearchScope=function()
2850 {}
2851 WebInspector.SearchScope.prototype={performSearch:function(searchConfig,progress,searchResultCallback,searchFinishedCallback){},performIndexing:function(progressIndicator,callback){},stopSearch:function(){},createSearchResultsPane:function(searchConfig){}}
2852 WebInspector.SearchResultsPane=function(searchConfig)
2853 {this._searchConfig=searchConfig;this.element=document.createElement("div");}
2854 WebInspector.SearchResultsPane.prototype={get searchConfig()
2855 {return this._searchConfig;},addSearchResult:function(searchResult){}}
2856 WebInspector.FileBasedSearchResultsPane=function(searchConfig)
2857 {WebInspector.SearchResultsPane.call(this,searchConfig);this._searchResults=[];this.element.id="search-results-pane-file-based";this._treeOutlineElement=document.createElement("ol");this._treeOutlineElement.className="search-results-outline-disclosure";this.element.appendChild(this._treeOutlineElement);this._treeOutline=new TreeOutline(this._treeOutlineElement);this._matchesExpandedCount=0;}
2858 WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount=20;WebInspector.FileBasedSearchResultsPane.fileMatchesShownAtOnce=20;WebInspector.FileBasedSearchResultsPane.prototype={_createAnchor:function(uiSourceCode,lineNumber,columnNumber)
2859 {var anchor=document.createElement("a");anchor.preferredPanel="sources";anchor.href=sanitizeHref(uiSourceCode.originURL());anchor.uiSourceCode=uiSourceCode;anchor.lineNumber=lineNumber;return anchor;},addSearchResult:function(searchResult)
2860 {this._searchResults.push(searchResult);var uiSourceCode=searchResult.uiSourceCode;if(!uiSourceCode)
2861 return;var searchMatches=searchResult.searchMatches;var fileTreeElement=this._addFileTreeElement(uiSourceCode.fullDisplayName(),searchMatches.length,this._searchResults.length-1);},_fileTreeElementExpanded:function(searchResult,fileTreeElement)
2862 {if(fileTreeElement._initialized)
2863 return;var toIndex=Math.min(searchResult.searchMatches.length,WebInspector.FileBasedSearchResultsPane.fileMatchesShownAtOnce);if(toIndex<searchResult.searchMatches.length){this._appendSearchMatches(fileTreeElement,searchResult,0,toIndex-1);this._appendShowMoreMatchesElement(fileTreeElement,searchResult,toIndex-1);}else
2864 this._appendSearchMatches(fileTreeElement,searchResult,0,toIndex);fileTreeElement._initialized=true;},_appendSearchMatches:function(fileTreeElement,searchResult,fromIndex,toIndex)
2865 {var uiSourceCode=searchResult.uiSourceCode;var searchMatches=searchResult.searchMatches;var queries=this._searchConfig.queries();var regexes=[];for(var i=0;i<queries.length;++i)
2866 regexes.push(createSearchRegex(queries[i],!this._searchConfig.ignoreCase,this._searchConfig.isRegex));for(var i=fromIndex;i<toIndex;++i){var lineNumber=searchMatches[i].lineNumber;var lineContent=searchMatches[i].lineContent;var matchRanges=[];for(var j=0;j<regexes.length;++j)
2867 matchRanges=matchRanges.concat(this._regexMatchRanges(lineContent,regexes[j]));var anchor=this._createAnchor(uiSourceCode,lineNumber,matchRanges[0].offset);var numberString=numberToStringWithSpacesPadding(lineNumber+1,4);var lineNumberSpan=document.createElement("span");lineNumberSpan.classList.add("search-match-line-number");lineNumberSpan.textContent=numberString;anchor.appendChild(lineNumberSpan);var contentSpan=this._createContentSpan(lineContent,matchRanges);anchor.appendChild(contentSpan);var searchMatchElement=new TreeElement("");searchMatchElement.selectable=false;fileTreeElement.appendChild(searchMatchElement);searchMatchElement.listItemElement.className="search-match source-code";searchMatchElement.listItemElement.appendChild(anchor);}},_appendShowMoreMatchesElement:function(fileTreeElement,searchResult,startMatchIndex)
2868 {var matchesLeftCount=searchResult.searchMatches.length-startMatchIndex;var showMoreMatchesText=WebInspector.UIString("Show all matches (%d more).",matchesLeftCount);var showMoreMatchesElement=new TreeElement(showMoreMatchesText);fileTreeElement.appendChild(showMoreMatchesElement);showMoreMatchesElement.listItemElement.classList.add("show-more-matches");showMoreMatchesElement.onselect=this._showMoreMatchesElementSelected.bind(this,searchResult,startMatchIndex,showMoreMatchesElement);},_showMoreMatchesElementSelected:function(searchResult,startMatchIndex,showMoreMatchesElement)
2869 {var fileTreeElement=showMoreMatchesElement.parent;fileTreeElement.removeChild(showMoreMatchesElement);this._appendSearchMatches(fileTreeElement,searchResult,startMatchIndex,searchResult.searchMatches.length);return false;},_addFileTreeElement:function(fileName,searchMatchesCount,searchResultIndex)
2870 {var fileTreeElement=new TreeElement("",null,true);fileTreeElement.toggleOnClick=true;fileTreeElement.selectable=false;this._treeOutline.appendChild(fileTreeElement);fileTreeElement.listItemElement.classList.add("search-result");var fileNameSpan=document.createElement("span");fileNameSpan.className="search-result-file-name";fileNameSpan.textContent=fileName;fileTreeElement.listItemElement.appendChild(fileNameSpan);var matchesCountSpan=document.createElement("span");matchesCountSpan.className="search-result-matches-count";if(searchMatchesCount===1)
2871 matchesCountSpan.textContent=WebInspector.UIString("(%d match)",searchMatchesCount);else
2872 matchesCountSpan.textContent=WebInspector.UIString("(%d matches)",searchMatchesCount);fileTreeElement.listItemElement.appendChild(matchesCountSpan);var searchResult=this._searchResults[searchResultIndex];fileTreeElement.onexpand=this._fileTreeElementExpanded.bind(this,searchResult,fileTreeElement);if(this._matchesExpandedCount<WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount)
2873 fileTreeElement.expand();this._matchesExpandedCount+=searchResult.searchMatches.length;return fileTreeElement;},_regexMatchRanges:function(lineContent,regex)
2874 {regex.lastIndex=0;var match;var offset=0;var matchRanges=[];while((regex.lastIndex<lineContent.length)&&(match=regex.exec(lineContent)))
2875 matchRanges.push(new WebInspector.SourceRange(match.index,match[0].length));return matchRanges;},_createContentSpan:function(lineContent,matchRanges)
2876 {var contentSpan=document.createElement("span");contentSpan.className="search-match-content";contentSpan.textContent=lineContent;WebInspector.highlightRangesWithStyleClass(contentSpan,matchRanges,"highlighted-match");return contentSpan;},__proto__:WebInspector.SearchResultsPane.prototype}
2877 WebInspector.FileBasedSearchResultsPane.SearchResult=function(uiSourceCode,searchMatches){this.uiSourceCode=uiSourceCode;this.searchMatches=searchMatches;}
2878 WebInspector.advancedSearchController;WebInspector.TimelineGrid=function()
2879 {this.element=document.createElement("div");this._itemsGraphsElement=document.createElement("div");this._itemsGraphsElement.id="resources-graphs";this.element.appendChild(this._itemsGraphsElement);this._dividersElement=this.element.createChild("div","resources-dividers");this._gridHeaderElement=document.createElement("div");this._eventDividersElement=this._gridHeaderElement.createChild("div","resources-event-dividers");this._dividersLabelBarElement=this._gridHeaderElement.createChild("div","resources-dividers-label-bar");this.element.appendChild(this._gridHeaderElement);this._leftCurtainElement=this.element.createChild("div","timeline-cpu-curtain-left");this._rightCurtainElement=this.element.createChild("div","timeline-cpu-curtain-right");this._gridSliceTime=1;}
2880 WebInspector.TimelineGrid.prototype={get itemsGraphsElement()
2881 {return this._itemsGraphsElement;},get dividersElement()
2882 {return this._dividersElement;},get dividersLabelBarElement()
2883 {return this._dividersLabelBarElement;},get gridHeaderElement()
2884 {return this._gridHeaderElement;},get gridSliceTime(){return this._gridSliceTime;},removeDividers:function()
2885 {this._dividersElement.removeChildren();this._dividersLabelBarElement.removeChildren();},updateDividers:function(calculator)
2886 {const minGridSlicePx=64;const gridFreeZoneAtLeftPx=50;var dividersElementClientWidth=this._dividersElement.clientWidth;var dividersCount=dividersElementClientWidth/minGridSlicePx;var gridSliceTime=calculator.boundarySpan()/dividersCount;var pixelsPerTime=dividersElementClientWidth/calculator.boundarySpan();var logGridSliceTime=Math.ceil(Math.log(gridSliceTime)/Math.LN10);gridSliceTime=Math.pow(10,logGridSliceTime);if(gridSliceTime*pixelsPerTime>=5*minGridSlicePx)
2887 gridSliceTime=gridSliceTime/5;if(gridSliceTime*pixelsPerTime>=2*minGridSlicePx)
2888 gridSliceTime=gridSliceTime/2;this._gridSliceTime=gridSliceTime;var firstDividerTime=Math.ceil((calculator.minimumBoundary()-calculator.zeroTime())/gridSliceTime)*gridSliceTime+calculator.zeroTime();var lastDividerTime=calculator.maximumBoundary();if(calculator.paddingLeft>0)
2889 lastDividerTime=lastDividerTime+minGridSlicePx/pixelsPerTime;dividersCount=Math.ceil((lastDividerTime-firstDividerTime)/gridSliceTime);var divider=this._dividersElement.firstChild;var dividerLabelBar=this._dividersLabelBarElement.firstChild;var skipLeftmostDividers=calculator.paddingLeft===0;if(!gridSliceTime)
2890 dividersCount=0;for(var i=0;i<dividersCount;++i){var left=calculator.computePosition(firstDividerTime+gridSliceTime*i);if(skipLeftmostDividers&&left<gridFreeZoneAtLeftPx)
2891 continue;if(!divider){divider=document.createElement("div");divider.className="resources-divider";this._dividersElement.appendChild(divider);dividerLabelBar=document.createElement("div");dividerLabelBar.className="resources-divider";var label=document.createElement("div");label.className="resources-divider-label";dividerLabelBar._labelElement=label;dividerLabelBar.appendChild(label);this._dividersLabelBarElement.appendChild(dividerLabelBar);}
2892 dividerLabelBar._labelElement.textContent=calculator.formatTime(firstDividerTime+gridSliceTime*i-calculator.minimumBoundary());var percentLeft=100*left/dividersElementClientWidth;divider.style.left=percentLeft+"%";dividerLabelBar.style.left=percentLeft+"%";divider=divider.nextSibling;dividerLabelBar=dividerLabelBar.nextSibling;}
2893 while(divider){var nextDivider=divider.nextSibling;this._dividersElement.removeChild(divider);divider=nextDivider;}
2894 while(dividerLabelBar){var nextDivider=dividerLabelBar.nextSibling;this._dividersLabelBarElement.removeChild(dividerLabelBar);dividerLabelBar=nextDivider;}
2895 return true;},addEventDivider:function(divider)
2896 {this._eventDividersElement.appendChild(divider);},addEventDividers:function(dividers)
2897 {this._gridHeaderElement.removeChild(this._eventDividersElement);for(var i=0;i<dividers.length;++i){if(dividers[i])
2898 this._eventDividersElement.appendChild(dividers[i]);}
2899 this._gridHeaderElement.appendChild(this._eventDividersElement);},removeEventDividers:function()
2900 {this._eventDividersElement.removeChildren();},hideEventDividers:function()
2901 {this._eventDividersElement.classList.add("hidden");},showEventDividers:function()
2902 {this._eventDividersElement.classList.remove("hidden");},hideCurtains:function()
2903 {this._leftCurtainElement.classList.add("hidden");this._rightCurtainElement.classList.add("hidden");},showCurtains:function(gapOffset,gapWidth)
2904 {this._leftCurtainElement.style.width=gapOffset+"px";this._leftCurtainElement.classList.remove("hidden");this._rightCurtainElement.style.left=(gapOffset+gapWidth)+"px";this._rightCurtainElement.classList.remove("hidden");},setScrollAndDividerTop:function(scrollTop,dividersTop)
2905 {this._dividersElement.style.top=scrollTop+"px";this._leftCurtainElement.style.top=scrollTop+"px";this._rightCurtainElement.style.top=scrollTop+"px";}}
2906 WebInspector.TimelineGrid.Calculator=function(){}
2907 WebInspector.TimelineGrid.Calculator.prototype={computePosition:function(time){return 0;},formatTime:function(time,hires){},minimumBoundary:function(){},zeroTime:function(){},maximumBoundary:function(){},boundarySpan:function(){}}
2908 WebInspector.OverviewGrid=function(prefix)
2909 {this.element=document.createElement("div");this.element.id=prefix+"-overview-container";this._grid=new WebInspector.TimelineGrid();this._grid.element.id=prefix+"-overview-grid";this._grid.setScrollAndDividerTop(0,0);this.element.appendChild(this._grid.element);this._window=new WebInspector.OverviewGrid.Window(this.element,this._grid.dividersLabelBarElement);}
2910 WebInspector.OverviewGrid.prototype={clientWidth:function()
2911 {return this.element.clientWidth;},updateDividers:function(calculator)
2912 {this._grid.updateDividers(calculator);},addEventDividers:function(dividers)
2913 {this._grid.addEventDividers(dividers);},removeEventDividers:function()
2914 {this._grid.removeEventDividers();},setWindowPosition:function(start,end)
2915 {this._window._setWindowPosition(start,end);},reset:function()
2916 {this._window.reset();},windowLeft:function()
2917 {return this._window.windowLeft;},windowRight:function()
2918 {return this._window.windowRight;},setWindow:function(left,right)
2919 {this._window._setWindow(left,right);},addEventListener:function(eventType,listener,thisObject)
2920 {this._window.addEventListener(eventType,listener,thisObject);},zoom:function(zoomFactor,referencePoint)
2921 {this._window._zoom(zoomFactor,referencePoint);},setResizeEnabled:function(enabled)
2922 {this._window._setEnabled(!!enabled);}}
2923 WebInspector.OverviewGrid.MinSelectableSize=14;WebInspector.OverviewGrid.WindowScrollSpeedFactor=.3;WebInspector.OverviewGrid.ResizerOffset=3.5;WebInspector.OverviewGrid.Window=function(parentElement,dividersLabelBarElement)
2924 {this._parentElement=parentElement;this._dividersLabelBarElement=dividersLabelBarElement;WebInspector.installDragHandle(this._parentElement,this._startWindowSelectorDragging.bind(this),this._windowSelectorDragging.bind(this),this._endWindowSelectorDragging.bind(this),"ew-resize",null);WebInspector.installDragHandle(this._dividersLabelBarElement,this._startWindowDragging.bind(this),this._windowDragging.bind(this),null,"move");this.windowLeft=0.0;this.windowRight=1.0;this._parentElement.addEventListener("mousewheel",this._onMouseWheel.bind(this),true);this._parentElement.addEventListener("dblclick",this._resizeWindowMaximum.bind(this),true);this._overviewWindowElement=parentElement.createChild("div","overview-grid-window");this._overviewWindowBordersElement=parentElement.createChild("div","overview-grid-window-rulers");parentElement.createChild("div","overview-grid-dividers-background");this._leftResizeElement=parentElement.createChild("div","overview-grid-window-resizer");this._leftResizeElement.style.left=0;WebInspector.installDragHandle(this._leftResizeElement,this._resizerElementStartDragging.bind(this),this._leftResizeElementDragging.bind(this),null,"ew-resize");this._rightResizeElement=parentElement.createChild("div","overview-grid-window-resizer overview-grid-window-resizer-right");this._rightResizeElement.style.right=0;WebInspector.installDragHandle(this._rightResizeElement,this._resizerElementStartDragging.bind(this),this._rightResizeElementDragging.bind(this),null,"ew-resize");this._setEnabled(true);}
2925 WebInspector.OverviewGrid.Events={WindowChanged:"WindowChanged"}
2926 WebInspector.OverviewGrid.Window.prototype={reset:function()
2927 {this.windowLeft=0.0;this.windowRight=1.0;this._overviewWindowElement.style.left="0%";this._overviewWindowElement.style.width="100%";this._overviewWindowBordersElement.style.left="0%";this._overviewWindowBordersElement.style.right="0%";this._leftResizeElement.style.left="0%";this._rightResizeElement.style.left="100%";this._setEnabled(true);},_setEnabled:function(enabled)
2928 {enabled=!!enabled;if(this._enabled===enabled)
2929 return;this._enabled=enabled;},_resizerElementStartDragging:function(event)
2930 {if(!this._enabled)
2931 return false;this._resizerParentOffsetLeft=event.pageX-event.offsetX-event.target.offsetLeft;event.preventDefault();return true;},_leftResizeElementDragging:function(event)
2932 {this._resizeWindowLeft(event.pageX-this._resizerParentOffsetLeft);event.preventDefault();},_rightResizeElementDragging:function(event)
2933 {this._resizeWindowRight(event.pageX-this._resizerParentOffsetLeft);event.preventDefault();},_startWindowSelectorDragging:function(event)
2934 {if(!this._enabled)
2935 return false;this._offsetLeft=event.pageX-event.offsetX;var position=event.pageX-this._offsetLeft;this._overviewWindowSelector=new WebInspector.OverviewGrid.WindowSelector(this._parentElement,position);return true;},_windowSelectorDragging:function(event)
2936 {this._overviewWindowSelector._updatePosition(event.pageX-this._offsetLeft);event.preventDefault();},_endWindowSelectorDragging:function(event)
2937 {var window=this._overviewWindowSelector._close(event.pageX-this._offsetLeft);delete this._overviewWindowSelector;if(window.end===window.start){var middle=window.end;window.start=Math.max(0,middle-WebInspector.OverviewGrid.MinSelectableSize/2);window.end=Math.min(this._parentElement.clientWidth,middle+WebInspector.OverviewGrid.MinSelectableSize/2);}else if(window.end-window.start<WebInspector.OverviewGrid.MinSelectableSize){if(this._parentElement.clientWidth-window.end>WebInspector.OverviewGrid.MinSelectableSize)
2938 window.end=window.start+WebInspector.OverviewGrid.MinSelectableSize;else
2939 window.start=window.end-WebInspector.OverviewGrid.MinSelectableSize;}
2940 this._setWindowPosition(window.start,window.end);},_startWindowDragging:function(event)
2941 {this._dragStartPoint=event.pageX;this._dragStartLeft=this.windowLeft;this._dragStartRight=this.windowRight;return true;},_windowDragging:function(event)
2942 {event.preventDefault();var delta=(event.pageX-this._dragStartPoint)/this._parentElement.clientWidth;if(this._dragStartLeft+delta<0)
2943 delta=-this._dragStartLeft;if(this._dragStartRight+delta>1)
2944 delta=1-this._dragStartRight;this._setWindow(this._dragStartLeft+delta,this._dragStartRight+delta);},_resizeWindowLeft:function(start)
2945 {if(start<10)
2946 start=0;else if(start>this._rightResizeElement.offsetLeft-4)
2947 start=this._rightResizeElement.offsetLeft-4;this._setWindowPosition(start,null);},_resizeWindowRight:function(end)
2948 {if(end>this._parentElement.clientWidth-10)
2949 end=this._parentElement.clientWidth;else if(end<this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.MinSelectableSize)
2950 end=this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.MinSelectableSize;this._setWindowPosition(null,end);},_resizeWindowMaximum:function()
2951 {this._setWindowPosition(0,this._parentElement.clientWidth);},_setWindow:function(windowLeft,windowRight)
2952 {var left=windowLeft;var right=windowRight;var width=windowRight-windowLeft;var widthInPixels=width*this._parentElement.clientWidth;var minWidthInPixels=WebInspector.OverviewGrid.MinSelectableSize/2;if(widthInPixels<minWidthInPixels){var factor=minWidthInPixels/widthInPixels;left=((windowRight+windowLeft)-width*factor)/2;right=((windowRight+windowLeft)+width*factor)/2;}
2953 this.windowLeft=windowLeft;this._leftResizeElement.style.left=left*100+"%";this.windowRight=windowRight;this._rightResizeElement.style.left=right*100+"%";this._overviewWindowElement.style.left=left*100+"%";this._overviewWindowBordersElement.style.left=left*100+"%";this._overviewWindowElement.style.width=(right-left)*100+"%";this._overviewWindowBordersElement.style.right=(1-right)*100+"%";this.dispatchEventToListeners(WebInspector.OverviewGrid.Events.WindowChanged);},_setWindowPosition:function(start,end)
2954 {var clientWidth=this._parentElement.clientWidth;var windowLeft=typeof start==="number"?start/clientWidth:this.windowLeft;var windowRight=typeof end==="number"?end/clientWidth:this.windowRight;this._setWindow(windowLeft,windowRight);},_onMouseWheel:function(event)
2955 {if(typeof event.wheelDeltaY==="number"&&event.wheelDeltaY){const zoomFactor=1.1;const mouseWheelZoomSpeed=1/120;var reference=event.offsetX/event.target.clientWidth;this._zoom(Math.pow(zoomFactor,-event.wheelDeltaY*mouseWheelZoomSpeed),reference);}
2956 if(typeof event.wheelDeltaX==="number"&&event.wheelDeltaX){var offset=Math.round(event.wheelDeltaX*WebInspector.OverviewGrid.WindowScrollSpeedFactor);var windowLeft=this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.ResizerOffset;var windowRight=this._rightResizeElement.offsetLeft+WebInspector.OverviewGrid.ResizerOffset;if(windowLeft-offset<0)
2957 offset=windowLeft;if(windowRight-offset>this._parentElement.clientWidth)
2958 offset=windowRight-this._parentElement.clientWidth;this._setWindowPosition(windowLeft-offset,windowRight-offset);event.preventDefault();}},_zoom:function(factor,reference)
2959 {var left=this.windowLeft;var right=this.windowRight;var windowSize=right-left;var newWindowSize=factor*windowSize;if(newWindowSize>1){newWindowSize=1;factor=newWindowSize/windowSize;}
2960 left=reference+(left-reference)*factor;left=Number.constrain(left,0,1-newWindowSize);right=reference+(right-reference)*factor;right=Number.constrain(right,newWindowSize,1);this._setWindow(left,right);},__proto__:WebInspector.Object.prototype}
2961 WebInspector.OverviewGrid.WindowSelector=function(parent,position)
2962 {this._startPosition=position;this._width=parent.offsetWidth;this._windowSelector=document.createElement("div");this._windowSelector.className="overview-grid-window-selector";this._windowSelector.style.left=this._startPosition+"px";this._windowSelector.style.right=this._width-this._startPosition+"px";parent.appendChild(this._windowSelector);}
2963 WebInspector.OverviewGrid.WindowSelector.prototype={_createSelectorElement:function(parent,left,width,height)
2964 {var selectorElement=document.createElement("div");selectorElement.className="overview-grid-window-selector";selectorElement.style.left=left+"px";selectorElement.style.width=width+"px";selectorElement.style.top="0px";selectorElement.style.height=height+"px";parent.appendChild(selectorElement);return selectorElement;},_close:function(position)
2965 {position=Math.max(0,Math.min(position,this._width));this._windowSelector.remove();return this._startPosition<position?{start:this._startPosition,end:position}:{start:position,end:this._startPosition};},_updatePosition:function(position)
2966 {position=Math.max(0,Math.min(position,this._width));if(position<this._startPosition){this._windowSelector.style.left=position+"px";this._windowSelector.style.right=this._width-this._startPosition+"px";}else{this._windowSelector.style.left=this._startPosition+"px";this._windowSelector.style.right=this._width-position+"px";}}}
2967 WebInspector.ContentProvider=function(){}
2968 WebInspector.ContentProvider.prototype={contentURL:function(){},contentType:function(){},requestContent:function(callback){},searchInContent:function(query,caseSensitive,isRegex,callback){}}
2969 WebInspector.ContentProvider.SearchMatch=function(lineNumber,lineContent){this.lineNumber=lineNumber;this.lineContent=lineContent;}
2970 WebInspector.ContentProvider.performSearchInContent=function(content,query,caseSensitive,isRegex)
2971 {var regex=createSearchRegex(query,caseSensitive,isRegex);var result=[];var lineEndings=content.lineEndings();for(var i=0;i<lineEndings.length;++i){var lineStart=i>0?lineEndings[i-1]+1:0;var lineEnd=lineEndings[i];var lineContent=content.substring(lineStart,lineEnd);if(lineContent.length>0&&lineContent.charAt(lineContent.length-1)==="\r")
2972 lineContent=lineContent.substring(0,lineContent.length-1)
2973 regex.lastIndex=0;if(regex.exec(lineContent))
2974 result.push(new WebInspector.ContentProvider.SearchMatch(i,lineContent));}
2975 return result;}
2976 WebInspector.Resource=function(request,url,documentURL,frameId,loaderId,type,mimeType,isHidden)
2977 {this._request=request;this.url=url;this._documentURL=documentURL;this._frameId=frameId;this._loaderId=loaderId;this._type=type||WebInspector.resourceTypes.Other;this._mimeType=mimeType;this._isHidden=isHidden;this._content;this._contentEncoded;this._pendingContentCallbacks=[];if(this._request&&!this._request.finished)
2978 this._request.addEventListener(WebInspector.NetworkRequest.Events.FinishedLoading,this._requestFinished,this);}
2979 WebInspector.Resource.Events={MessageAdded:"message-added",MessagesCleared:"messages-cleared",}
2980 WebInspector.Resource.prototype={get request()
2981 {return this._request;},get url()
2982 {return this._url;},set url(x)
2983 {this._url=x;this._parsedURL=new WebInspector.ParsedURL(x);},get parsedURL()
2984 {return this._parsedURL;},get documentURL()
2985 {return this._documentURL;},get frameId()
2986 {return this._frameId;},get loaderId()
2987 {return this._loaderId;},get displayName()
2988 {return this._parsedURL.displayName;},get type()
2989 {return this._request?this._request.type:this._type;},get mimeType()
2990 {return this._request?this._request.mimeType:this._mimeType;},get messages()
2991 {return this._messages||[];},addMessage:function(msg)
2992 {if(!msg.isErrorOrWarning()||!msg.message)
2993 return;if(!this._messages)
2994 this._messages=[];this._messages.push(msg);this.dispatchEventToListeners(WebInspector.Resource.Events.MessageAdded,msg);},get errors()
2995 {return this._errors||0;},set errors(x)
2996 {this._errors=x;},get warnings()
2997 {return this._warnings||0;},set warnings(x)
2998 {this._warnings=x;},clearErrorsAndWarnings:function()
2999 {this._messages=[];this._warnings=0;this._errors=0;this.dispatchEventToListeners(WebInspector.Resource.Events.MessagesCleared);},get content()
3000 {return this._content;},get contentEncoded()
3001 {return this._contentEncoded;},contentURL:function()
3002 {return this._url;},contentType:function()
3003 {return this.type;},requestContent:function(callback)
3004 {if(typeof this._content!=="undefined"){callback(this._content);return;}
3005 this._pendingContentCallbacks.push(callback);if(!this._request||this._request.finished)
3006 this._innerRequestContent();},canonicalMimeType:function()
3007 {return this.type.canonicalMimeType()||this.mimeType;},searchInContent:function(query,caseSensitive,isRegex,callback)
3008 {function callbackWrapper(error,searchMatches)
3009 {callback(searchMatches||[]);}
3010 if(this.type===WebInspector.resourceTypes.Document){this.requestContent(documentContentLoaded);return;}
3011 function documentContentLoaded(content)
3012 {if(content===null){callback([]);return;}
3013 var result=WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex);callback(result);}
3014 if(this.frameId)
3015 PageAgent.searchInResource(this.frameId,this.url,query,caseSensitive,isRegex,callbackWrapper);else
3016 callback([]);},populateImageSource:function(image)
3017 {function onResourceContent(content)
3018 {var imageSrc=WebInspector.contentAsDataURL(this._content,this.mimeType,this._contentEncoded);if(imageSrc===null)
3019 imageSrc=this.url;image.src=imageSrc;}
3020 this.requestContent(onResourceContent.bind(this));},_requestFinished:function()
3021 {this._request.removeEventListener(WebInspector.NetworkRequest.Events.FinishedLoading,this._requestFinished,this);if(this._pendingContentCallbacks.length)
3022 this._innerRequestContent();},_innerRequestContent:function()
3023 {if(this._contentRequested)
3024 return;this._contentRequested=true;function contentLoaded(error,content,contentEncoded)
3025 {if(error||content===null){loadFallbackContent.call(this,error);return;}
3026 replyWithContent.call(this,content,contentEncoded);}
3027 function replyWithContent(content,contentEncoded)
3028 {this._content=content;this._contentEncoded=contentEncoded;var callbacks=this._pendingContentCallbacks.slice();for(var i=0;i<callbacks.length;++i)
3029 callbacks[i](this._content);this._pendingContentCallbacks.length=0;delete this._contentRequested;}
3030 function resourceContentLoaded(error,content,contentEncoded)
3031 {contentLoaded.call(this,error,content,contentEncoded);}
3032 function loadFallbackContent(error)
3033 {var scripts=WebInspector.debuggerModel.scriptsForSourceURL(this.url);if(!scripts.length){console.error("Resource content request failed: "+error);replyWithContent.call(this,null,false);return;}
3034 var contentProvider;if(this.type===WebInspector.resourceTypes.Document)
3035 contentProvider=new WebInspector.ConcatenatedScriptsContentProvider(scripts);else if(this.type===WebInspector.resourceTypes.Script)
3036 contentProvider=scripts[0];if(!contentProvider){console.error("Resource content request failed: "+error);replyWithContent.call(this,null,false);return;}
3037 contentProvider.requestContent(fallbackContentLoaded.bind(this));}
3038 function fallbackContentLoaded(content)
3039 {replyWithContent.call(this,content,false);}
3040 if(this.request){this.request.requestContent(requestContentLoaded.bind(this));return;}
3041 function requestContentLoaded(content)
3042 {contentLoaded.call(this,null,content,this.request.contentEncoded);}
3043 PageAgent.getResourceContent(this.frameId,this.url,resourceContentLoaded.bind(this));},isHidden:function()
3044 {return!!this._isHidden;},__proto__:WebInspector.Object.prototype}
3045 WebInspector.NetworkRequest=function(requestId,url,documentURL,frameId,loaderId)
3046 {this._requestId=requestId;this.url=url;this._documentURL=documentURL;this._frameId=frameId;this._loaderId=loaderId;this._startTime=-1;this._endTime=-1;this.statusCode=0;this.statusText="";this.requestMethod="";this.requestTime=0;this._type=WebInspector.resourceTypes.Other;this._contentEncoded=false;this._pendingContentCallbacks=[];this._frames=[];this._responseHeaderValues={};}
3047 WebInspector.NetworkRequest.Events={FinishedLoading:"FinishedLoading",TimingChanged:"TimingChanged",RequestHeadersChanged:"RequestHeadersChanged",ResponseHeadersChanged:"ResponseHeadersChanged",}
3048 WebInspector.NetworkRequest.InitiatorType={Other:"other",Parser:"parser",Redirect:"redirect",Script:"script"}
3049 WebInspector.NetworkRequest.NameValue;WebInspector.NetworkRequest.prototype={get requestId()
3050 {return this._requestId;},set requestId(requestId)
3051 {this._requestId=requestId;},get url()
3052 {return this._url;},set url(x)
3053 {if(this._url===x)
3054 return;this._url=x;this._parsedURL=new WebInspector.ParsedURL(x);delete this._queryString;delete this._parsedQueryParameters;delete this._name;delete this._path;},get documentURL()
3055 {return this._documentURL;},get parsedURL()
3056 {return this._parsedURL;},get frameId()
3057 {return this._frameId;},get loaderId()
3058 {return this._loaderId;},get startTime()
3059 {return this._startTime||-1;},set startTime(x)
3060 {this._startTime=x;},get responseReceivedTime()
3061 {return this._responseReceivedTime||-1;},set responseReceivedTime(x)
3062 {this._responseReceivedTime=x;},get endTime()
3063 {return this._endTime||-1;},set endTime(x)
3064 {if(this.timing&&this.timing.requestTime){this._endTime=Math.max(x,this.responseReceivedTime);}else{this._endTime=x;if(this._responseReceivedTime>x)
3065 this._responseReceivedTime=x;}},get duration()
3066 {if(this._endTime===-1||this._startTime===-1)
3067 return-1;return this._endTime-this._startTime;},get latency()
3068 {if(this._responseReceivedTime===-1||this._startTime===-1)
3069 return-1;return this._responseReceivedTime-this._startTime;},get resourceSize()
3070 {return this._resourceSize||0;},set resourceSize(x)
3071 {this._resourceSize=x;},get transferSize()
3072 {if(typeof this._transferSize==="number")
3073 return this._transferSize;if(this.statusCode===304)
3074 return this.responseHeadersSize;if(this._cached)
3075 return 0;var bodySize=Number(this.responseHeaderValue("Content-Length")||this.resourceSize);return this.responseHeadersSize+bodySize;},increaseTransferSize:function(x)
3076 {this._transferSize=(this._transferSize||0)+x;},get finished()
3077 {return this._finished;},set finished(x)
3078 {if(this._finished===x)
3079 return;this._finished=x;if(x){this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.FinishedLoading,this);if(this._pendingContentCallbacks.length)
3080 this._innerRequestContent();}},get failed()
3081 {return this._failed;},set failed(x)
3082 {this._failed=x;},get canceled()
3083 {return this._canceled;},set canceled(x)
3084 {this._canceled=x;},get cached()
3085 {return!!this._cached&&!this._transferSize;},set cached(x)
3086 {this._cached=x;if(x)
3087 delete this._timing;},get timing()
3088 {return this._timing;},set timing(x)
3089 {if(x&&!this._cached){this._startTime=x.requestTime;this._responseReceivedTime=x.requestTime+x.receiveHeadersEnd/1000.0;this._timing=x;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.TimingChanged,this);}},get mimeType()
3090 {return this._mimeType;},set mimeType(x)
3091 {this._mimeType=x;},get displayName()
3092 {return this._parsedURL.displayName;},name:function()
3093 {if(this._name)
3094 return this._name;this._parseNameAndPathFromURL();return this._name;},path:function()
3095 {if(this._path)
3096 return this._path;this._parseNameAndPathFromURL();return this._path;},_parseNameAndPathFromURL:function()
3097 {if(this._parsedURL.isDataURL()){this._name=this._parsedURL.dataURLDisplayName();this._path="";}else if(this._parsedURL.isAboutBlank()){this._name=this._parsedURL.url;this._path="";}else{this._path=this._parsedURL.host+this._parsedURL.folderPathComponents;this._path=this._path.trimURL(WebInspector.inspectedPageDomain?WebInspector.inspectedPageDomain:"");if(this._parsedURL.lastPathComponent||this._parsedURL.queryParams)
3098 this._name=this._parsedURL.lastPathComponent+(this._parsedURL.queryParams?"?"+this._parsedURL.queryParams:"");else if(this._parsedURL.folderPathComponents){this._name=this._parsedURL.folderPathComponents.substring(this._parsedURL.folderPathComponents.lastIndexOf("/")+1)+"/";this._path=this._path.substring(0,this._path.lastIndexOf("/"));}else{this._name=this._parsedURL.host;this._path="";}}},get folder()
3099 {var path=this._parsedURL.path;var indexOfQuery=path.indexOf("?");if(indexOfQuery!==-1)
3100 path=path.substring(0,indexOfQuery);var lastSlashIndex=path.lastIndexOf("/");return lastSlashIndex!==-1?path.substring(0,lastSlashIndex):"";},get type()
3101 {return this._type;},set type(x)
3102 {this._type=x;},get domain()
3103 {return this._parsedURL.host;},get scheme()
3104 {return this._parsedURL.scheme;},get redirectSource()
3105 {if(this.redirects&&this.redirects.length>0)
3106 return this.redirects[this.redirects.length-1];return this._redirectSource;},set redirectSource(x)
3107 {this._redirectSource=x;delete this._initiatorInfo;},requestHeaders:function()
3108 {return this._requestHeaders||[];},setRequestHeaders:function(headers)
3109 {this._requestHeaders=headers;delete this._requestCookies;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RequestHeadersChanged);},requestHeadersText:function()
3110 {return this._requestHeadersText;},setRequestHeadersText:function(text)
3111 {this._requestHeadersText=text;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RequestHeadersChanged);},requestHeaderValue:function(headerName)
3112 {return this._headerValue(this.requestHeaders(),headerName);},get requestCookies()
3113 {if(!this._requestCookies)
3114 this._requestCookies=WebInspector.CookieParser.parseCookie(this.requestHeaderValue("Cookie"));return this._requestCookies;},get requestFormData()
3115 {return this._requestFormData;},set requestFormData(x)
3116 {this._requestFormData=x;delete this._parsedFormParameters;},requestHttpVersion:function()
3117 {var headersText=this.requestHeadersText();if(!headersText)
3118 return undefined;var firstLine=headersText.split(/\r\n/)[0];var match=firstLine.match(/(HTTP\/\d+\.\d+)$/);return match?match[1]:undefined;},get responseHeaders()
3119 {return this._responseHeaders||[];},set responseHeaders(x)
3120 {this._responseHeaders=x;delete this._sortedResponseHeaders;delete this._responseCookies;this._responseHeaderValues={};this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.ResponseHeadersChanged);},get responseHeadersText()
3121 {if(typeof this._responseHeadersText==="undefined"){this._responseHeadersText="HTTP/1.1 "+this.statusCode+" "+this.statusText+"\r\n";for(var i=0;i<this.responseHeaders.length;++i)
3122 this._responseHeadersText+=this.responseHeaders[i].name+": "+this.responseHeaders[i].value+"\r\n";}
3123 return this._responseHeadersText;},set responseHeadersText(x)
3124 {this._responseHeadersText=x;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.ResponseHeadersChanged);},get responseHeadersSize()
3125 {return this.responseHeadersText.length;},get sortedResponseHeaders()
3126 {if(this._sortedResponseHeaders!==undefined)
3127 return this._sortedResponseHeaders;this._sortedResponseHeaders=this.responseHeaders.slice();this._sortedResponseHeaders.sort(function(a,b){return a.name.toLowerCase().compareTo(b.name.toLowerCase());});return this._sortedResponseHeaders;},responseHeaderValue:function(headerName)
3128 {var value=this._responseHeaderValues[headerName];if(value===undefined){value=this._headerValue(this.responseHeaders,headerName);this._responseHeaderValues[headerName]=(value!==undefined)?value:null;}
3129 return(value!==null)?value:undefined;},get responseCookies()
3130 {if(!this._responseCookies)
3131 this._responseCookies=WebInspector.CookieParser.parseSetCookie(this.responseHeaderValue("Set-Cookie"));return this._responseCookies;},queryString:function()
3132 {if(this._queryString!==undefined)
3133 return this._queryString;var queryString=null;var url=this.url;var questionMarkPosition=url.indexOf("?");if(questionMarkPosition!==-1){queryString=url.substring(questionMarkPosition+1);var hashSignPosition=queryString.indexOf("#");if(hashSignPosition!==-1)
3134 queryString=queryString.substring(0,hashSignPosition);}
3135 this._queryString=queryString;return this._queryString;},get queryParameters()
3136 {if(this._parsedQueryParameters)
3137 return this._parsedQueryParameters;var queryString=this.queryString();if(!queryString)
3138 return null;this._parsedQueryParameters=this._parseParameters(queryString);return this._parsedQueryParameters;},get formParameters()
3139 {if(this._parsedFormParameters)
3140 return this._parsedFormParameters;if(!this.requestFormData)
3141 return null;var requestContentType=this.requestContentType();if(!requestContentType||!requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i))
3142 return null;this._parsedFormParameters=this._parseParameters(this.requestFormData);return this._parsedFormParameters;},get responseHttpVersion()
3143 {var match=this.responseHeadersText.match(/^(HTTP\/\d+\.\d+)/);return match?match[1]:undefined;},_parseParameters:function(queryString)
3144 {function parseNameValue(pair)
3145 {var splitPair=pair.split("=",2);return{name:splitPair[0],value:splitPair[1]||""};}
3146 return queryString.split("&").map(parseNameValue);},_headerValue:function(headers,headerName)
3147 {headerName=headerName.toLowerCase();var values=[];for(var i=0;i<headers.length;++i){if(headers[i].name.toLowerCase()===headerName)
3148 values.push(headers[i].value);}
3149 if(!values.length)
3150 return undefined;if(headerName==="set-cookie")
3151 return values.join("\n");return values.join(", ");},get content()
3152 {return this._content;},get contentEncoded()
3153 {return this._contentEncoded;},contentURL:function()
3154 {return this._url;},contentType:function()
3155 {return this._type;},requestContent:function(callback)
3156 {if(this.type===WebInspector.resourceTypes.WebSocket){callback(null);return;}
3157 if(typeof this._content!=="undefined"){callback(this.content||null);return;}
3158 this._pendingContentCallbacks.push(callback);if(this.finished)
3159 this._innerRequestContent();},searchInContent:function(query,caseSensitive,isRegex,callback)
3160 {callback([]);},isHttpFamily:function()
3161 {return!!this.url.match(/^https?:/i);},requestContentType:function()
3162 {return this.requestHeaderValue("Content-Type");},isPingRequest:function()
3163 {return"text/ping"===this.requestContentType();},hasErrorStatusCode:function()
3164 {return this.statusCode>=400;},populateImageSource:function(image)
3165 {function onResourceContent(content)
3166 {var imageSrc=this.asDataURL();if(imageSrc===null)
3167 imageSrc=this.url;image.src=imageSrc;}
3168 this.requestContent(onResourceContent.bind(this));},asDataURL:function()
3169 {return WebInspector.contentAsDataURL(this._content,this.mimeType,this._contentEncoded);},_innerRequestContent:function()
3170 {if(this._contentRequested)
3171 return;this._contentRequested=true;function onResourceContent(error,content,contentEncoded)
3172 {this._content=error?null:content;this._contentEncoded=contentEncoded;var callbacks=this._pendingContentCallbacks.slice();for(var i=0;i<callbacks.length;++i)
3173 callbacks[i](this._content);this._pendingContentCallbacks.length=0;delete this._contentRequested;}
3174 NetworkAgent.getResponseBody(this._requestId,onResourceContent.bind(this));},initiatorInfo:function()
3175 {if(this._initiatorInfo)
3176 return this._initiatorInfo;var type=WebInspector.NetworkRequest.InitiatorType.Other;var url="";var lineNumber=-Infinity;var columnNumber=-Infinity;if(this.redirectSource){type=WebInspector.NetworkRequest.InitiatorType.Redirect;url=this.redirectSource.url;}else if(this.initiator){if(this.initiator.type===NetworkAgent.InitiatorType.Parser){type=WebInspector.NetworkRequest.InitiatorType.Parser;url=this.initiator.url;lineNumber=this.initiator.lineNumber;}else if(this.initiator.type===NetworkAgent.InitiatorType.Script){var topFrame=this.initiator.stackTrace[0];if(topFrame.url){type=WebInspector.NetworkRequest.InitiatorType.Script;url=topFrame.url;lineNumber=topFrame.lineNumber;columnNumber=topFrame.columnNumber;}}}
3177 this._initiatorInfo={type:type,url:url,source:WebInspector.displayNameForURL(url),lineNumber:lineNumber,columnNumber:columnNumber};return this._initiatorInfo;},frames:function()
3178 {return this._frames;},frame:function(position)
3179 {return this._frames[position];},addFrameError:function(errorMessage,time)
3180 {this._pushFrame({errorMessage:errorMessage,time:time});},addFrame:function(response,time,sent)
3181 {response.time=time;if(sent)
3182 response.sent=sent;this._pushFrame(response);},_pushFrame:function(frameOrError)
3183 {if(this._frames.length>=100)
3184 this._frames.splice(0,10);this._frames.push(frameOrError);},__proto__:WebInspector.Object.prototype}
3185 WebInspector.UISourceCode=function(project,parentPath,name,originURL,url,contentType,isEditable)
3186 {this._project=project;this._parentPath=parentPath;this._name=name;this._originURL=originURL;this._url=url;this._contentType=contentType;this._isEditable=isEditable;this._requestContentCallbacks=[];this._liveLocations=new Set();this._consoleMessages=[];this.history=[];if(this.isEditable()&&this._url)
3187 this._restoreRevisionHistory();this._formatterMapping=new WebInspector.IdentityFormatterSourceMapping();}
3188 WebInspector.UISourceCode.Events={FormattedChanged:"FormattedChanged",WorkingCopyChanged:"WorkingCopyChanged",WorkingCopyCommitted:"WorkingCopyCommitted",TitleChanged:"TitleChanged",SavedStateUpdated:"SavedStateUpdated",ConsoleMessageAdded:"ConsoleMessageAdded",ConsoleMessageRemoved:"ConsoleMessageRemoved",ConsoleMessagesCleared:"ConsoleMessagesCleared",SourceMappingChanged:"SourceMappingChanged",}
3189 WebInspector.UISourceCode.prototype={get url()
3190 {return this._url;},name:function()
3191 {return this._name;},parentPath:function()
3192 {return this._parentPath;},path:function()
3193 {return this._parentPath?this._parentPath+"/"+this._name:this._name;},fullDisplayName:function()
3194 {return this._project.displayName()+"/"+(this._parentPath?this._parentPath+"/":"")+this.displayName(true);},displayName:function(skipTrim)
3195 {var displayName=this.name()||WebInspector.UIString("(index)");return skipTrim?displayName:displayName.trimEnd(100);},uri:function()
3196 {var path=this.path();if(!this._project.id())
3197 return path;if(!path)
3198 return this._project.id();return this._project.id()+"/"+path;},originURL:function()
3199 {return this._originURL;},canRename:function()
3200 {return this._project.canRename();},rename:function(newName,callback)
3201 {this._project.rename(this,newName,innerCallback.bind(this));function innerCallback(success,newName,newURL,newOriginURL,newContentType)
3202 {if(success)
3203 this._updateName((newName),(newURL),(newOriginURL),(newContentType));callback(success);}},_updateName:function(name,url,originURL,contentType)
3204 {var oldURI=this.uri();this._name=name;if(url)
3205 this._url=url;if(originURL)
3206 this._originURL=originURL;if(contentType)
3207 this._contentType=contentType;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged,oldURI);},contentURL:function()
3208 {return this.originURL();},contentType:function()
3209 {return this._contentType;},scriptFile:function()
3210 {return this._scriptFile;},setScriptFile:function(scriptFile)
3211 {this._scriptFile=scriptFile;},project:function()
3212 {return this._project;},requestMetadata:function(callback)
3213 {this._project.requestMetadata(this,callback);},requestContent:function(callback)
3214 {if(this._content||this._contentLoaded){callback(this._content);return;}
3215 this._requestContentCallbacks.push(callback);if(this._requestContentCallbacks.length===1)
3216 this._project.requestFileContent(this,this._fireContentAvailable.bind(this));},checkContentUpdated:function(callback)
3217 {if(!this._project.canSetFileContent())
3218 return;if(this._checkingContent)
3219 return;this._checkingContent=true;this._project.requestFileContent(this,contentLoaded.bind(this));function contentLoaded(updatedContent)
3220 {if(updatedContent===null){var workingCopy=this.workingCopy();this._commitContent("",false);this.setWorkingCopy(workingCopy);delete this._checkingContent;if(callback)
3221 callback();return;}
3222 if(typeof this._lastAcceptedContent==="string"&&this._lastAcceptedContent===updatedContent){delete this._checkingContent;if(callback)
3223 callback();return;}
3224 if(this._content===updatedContent){delete this._lastAcceptedContent;delete this._checkingContent;if(callback)
3225 callback();return;}
3226 if(!this.isDirty()){this._commitContent(updatedContent,false);delete this._checkingContent;if(callback)
3227 callback();return;}
3228 var shouldUpdate=window.confirm(WebInspector.UIString("This file was changed externally. Would you like to reload it?"));if(shouldUpdate)
3229 this._commitContent(updatedContent,false);else
3230 this._lastAcceptedContent=updatedContent;delete this._checkingContent;if(callback)
3231 callback();}},requestOriginalContent:function(callback)
3232 {this._project.requestFileContent(this,callback);},_commitContent:function(content,shouldSetContentInProject)
3233 {delete this._lastAcceptedContent;this._content=content;this._contentLoaded=true;var lastRevision=this.history.length?this.history[this.history.length-1]:null;if(!lastRevision||lastRevision._content!==this._content){var revision=new WebInspector.Revision(this,this._content,new Date());this.history.push(revision);revision._persist();}
3234 this._innerResetWorkingCopy();this._hasCommittedChanges=true;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted);if(this._url&&WebInspector.fileManager.isURLSaved(this._url))
3235 this._saveURLWithFileManager(false,this._content);if(shouldSetContentInProject)
3236 this._project.setFileContent(this,this._content,function(){});},_saveURLWithFileManager:function(forceSaveAs,content)
3237 {WebInspector.fileManager.save(this._url,(content),forceSaveAs,callback.bind(this));WebInspector.fileManager.close(this._url);function callback(accepted)
3238 {if(!accepted)
3239 return;this._savedWithFileManager=true;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.SavedStateUpdated);}},saveToFileSystem:function(forceSaveAs)
3240 {if(this.isDirty()){this._saveURLWithFileManager(forceSaveAs,this.workingCopy());this.commitWorkingCopy(function(){});return;}
3241 this.requestContent(this._saveURLWithFileManager.bind(this,forceSaveAs));},hasUnsavedCommittedChanges:function()
3242 {if(this._savedWithFileManager||this.project().canSetFileContent()||!this._isEditable)
3243 return false;if(this._project.workspace().hasResourceContentTrackingExtensions())
3244 return false;return!!this._hasCommittedChanges;},addRevision:function(content)
3245 {this._commitContent(content,true);},_restoreRevisionHistory:function()
3246 {if(!window.localStorage)
3247 return;var registry=WebInspector.Revision._revisionHistoryRegistry();var historyItems=registry[this.url];if(!historyItems)
3248 return;function filterOutStale(historyItem)
3249 {if(!WebInspector.resourceTreeModel.mainFrame)
3250 return false;return historyItem.loaderId===WebInspector.resourceTreeModel.mainFrame.loaderId;}
3251 historyItems=historyItems.filter(filterOutStale);if(!historyItems.length)
3252 return;for(var i=0;i<historyItems.length;++i){var content=window.localStorage[historyItems[i].key];var timestamp=new Date(historyItems[i].timestamp);var revision=new WebInspector.Revision(this,content,timestamp);this.history.push(revision);}
3253 this._content=this.history[this.history.length-1].content;this._hasCommittedChanges=true;this._contentLoaded=true;},_clearRevisionHistory:function()
3254 {if(!window.localStorage)
3255 return;var registry=WebInspector.Revision._revisionHistoryRegistry();var historyItems=registry[this.url];for(var i=0;historyItems&&i<historyItems.length;++i)
3256 delete window.localStorage[historyItems[i].key];delete registry[this.url];window.localStorage["revision-history"]=JSON.stringify(registry);},revertToOriginal:function()
3257 {function callback(content)
3258 {if(typeof content!=="string")
3259 return;this.addRevision(content);}
3260 this.requestOriginalContent(callback.bind(this));WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.ApplyOriginalContent,url:this.url});},revertAndClearHistory:function(callback)
3261 {function revert(content)
3262 {if(typeof content!=="string")
3263 return;this.addRevision(content);this._clearRevisionHistory();this.history=[];callback(this);}
3264 this.requestOriginalContent(revert.bind(this));WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.RevertRevision,url:this.url});},isEditable:function()
3265 {return this._isEditable;},workingCopy:function()
3266 {if(this._workingCopyGetter){this._workingCopy=this._workingCopyGetter();delete this._workingCopyGetter;}
3267 if(this.isDirty())
3268 return this._workingCopy;return this._content;},resetWorkingCopy:function()
3269 {this._innerResetWorkingCopy();this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},_innerResetWorkingCopy:function()
3270 {delete this._workingCopy;delete this._workingCopyGetter;},setWorkingCopy:function(newWorkingCopy)
3271 {this._workingCopy=newWorkingCopy;delete this._workingCopyGetter;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},setWorkingCopyGetter:function(workingCopyGetter)
3272 {this._workingCopyGetter=workingCopyGetter;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},removeWorkingCopyGetter:function()
3273 {if(!this._workingCopyGetter)
3274 return;this._workingCopy=this._workingCopyGetter();delete this._workingCopyGetter;},commitWorkingCopy:function(callback)
3275 {if(!this.isDirty()){callback(null);return;}
3276 this._commitContent(this.workingCopy(),true);callback(null);WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.FileSaved,url:this.url});},isDirty:function()
3277 {return typeof this._workingCopy!=="undefined"||typeof this._workingCopyGetter!=="undefined";},_mimeType:function()
3278 {return this.contentType().canonicalMimeType();},highlighterType:function()
3279 {var lastIndexOfDot=this._name.lastIndexOf(".");var extension=lastIndexOfDot!==-1?this._name.substr(lastIndexOfDot+1):"";var indexOfQuestionMark=extension.indexOf("?");if(indexOfQuestionMark!==-1)
3280 extension=extension.substr(0,indexOfQuestionMark);var mimeType=WebInspector.ResourceType.mimeTypesForExtensions[extension.toLowerCase()];return mimeType||this.contentType().canonicalMimeType();},content:function()
3281 {return this._content;},searchInContent:function(query,caseSensitive,isRegex,callback)
3282 {var content=this.content();if(content){var provider=new WebInspector.StaticContentProvider(this.contentType(),content);provider.searchInContent(query,caseSensitive,isRegex,callback);return;}
3283 this._project.searchInFileContent(this,query,caseSensitive,isRegex,callback);},_fireContentAvailable:function(content)
3284 {this._contentLoaded=true;this._content=content;var callbacks=this._requestContentCallbacks.slice();this._requestContentCallbacks=[];for(var i=0;i<callbacks.length;++i)
3285 callbacks[i](content);if(this._formatOnLoad){delete this._formatOnLoad;this.setFormatted(true);}},contentLoaded:function()
3286 {return this._contentLoaded;},uiLocationToRawLocation:function(lineNumber,columnNumber)
3287 {if(!this._sourceMapping)
3288 return null;var location=this._formatterMapping.formattedToOriginal(lineNumber,columnNumber);return this._sourceMapping.uiLocationToRawLocation(this,location[0],location[1]);},addLiveLocation:function(liveLocation)
3289 {this._liveLocations.add(liveLocation);},removeLiveLocation:function(liveLocation)
3290 {this._liveLocations.remove(liveLocation);},updateLiveLocations:function()
3291 {var items=this._liveLocations.items();for(var i=0;i<items.length;++i)
3292 items[i].update();},overrideLocation:function(uiLocation)
3293 {var location=this._formatterMapping.originalToFormatted(uiLocation.lineNumber,uiLocation.columnNumber);uiLocation.lineNumber=location[0];uiLocation.columnNumber=location[1];return uiLocation;},consoleMessages:function()
3294 {return this._consoleMessages;},consoleMessageAdded:function(message)
3295 {this._consoleMessages.push(message);this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMessageAdded,message);},consoleMessageRemoved:function(message)
3296 {this._consoleMessages.remove(message);this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMessageRemoved,message);},consoleMessagesCleared:function()
3297 {this._consoleMessages=[];this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMessagesCleared);},formatted:function()
3298 {return!!this._formatted;},setFormatted:function(formatted)
3299 {if(!this.contentLoaded()){this._formatOnLoad=formatted;return;}
3300 if(this._formatted===formatted)
3301 return;if(this.isDirty())
3302 return;this._formatted=formatted;this._contentLoaded=false;this._content=false;this.requestContent(didGetContent.bind(this));function didGetContent(content)
3303 {var formatter;if(!formatted)
3304 formatter=new WebInspector.IdentityFormatter();else
3305 formatter=WebInspector.Formatter.createFormatter(this.contentType());formatter.formatContent(this.highlighterType(),content||"",formattedChanged.bind(this));function formattedChanged(content,formatterMapping)
3306 {this._content=content;this._innerResetWorkingCopy();var oldFormatter=this._formatterMapping;this._formatterMapping=formatterMapping;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.FormattedChanged,{content:content,oldFormatter:oldFormatter,newFormatter:this._formatterMapping,});this.updateLiveLocations();}}},createFormatter:function()
3307 {return null;},hasSourceMapping:function()
3308 {return!!this._sourceMapping;},setSourceMapping:function(sourceMapping)
3309 {if(this._sourceMapping===sourceMapping)
3310 return;this._sourceMapping=sourceMapping;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.SourceMappingChanged);},__proto__:WebInspector.Object.prototype}
3311 WebInspector.UILocation=function(uiSourceCode,lineNumber,columnNumber)
3312 {this.uiSourceCode=uiSourceCode;this.lineNumber=lineNumber;this.columnNumber=columnNumber;}
3313 WebInspector.UILocation.prototype={uiLocationToRawLocation:function()
3314 {return this.uiSourceCode.uiLocationToRawLocation(this.lineNumber,this.columnNumber);},url:function()
3315 {return this.uiSourceCode.contentURL();},linkText:function()
3316 {var linkText=this.uiSourceCode.displayName();if(typeof this.lineNumber==="number")
3317 linkText+=":"+(this.lineNumber+1);return linkText;}}
3318 WebInspector.RawLocation=function()
3319 {}
3320 WebInspector.LiveLocation=function(rawLocation,updateDelegate)
3321 {this._rawLocation=rawLocation;this._updateDelegate=updateDelegate;this._uiSourceCodes=[];}
3322 WebInspector.LiveLocation.prototype={update:function()
3323 {var uiLocation=this.uiLocation();if(uiLocation){var uiSourceCode=uiLocation.uiSourceCode;if(this._uiSourceCodes.indexOf(uiSourceCode)===-1){uiSourceCode.addLiveLocation(this);this._uiSourceCodes.push(uiSourceCode);}
3324 var oneTime=this._updateDelegate(uiLocation);if(oneTime)
3325 this.dispose();}},rawLocation:function()
3326 {return this._rawLocation;},uiLocation:function()
3327 {},dispose:function()
3328 {for(var i=0;i<this._uiSourceCodes.length;++i)
3329 this._uiSourceCodes[i].removeLiveLocation(this);this._uiSourceCodes=[];}}
3330 WebInspector.Revision=function(uiSourceCode,content,timestamp)
3331 {this._uiSourceCode=uiSourceCode;this._content=content;this._timestamp=timestamp;}
3332 WebInspector.Revision._revisionHistoryRegistry=function()
3333 {if(!WebInspector.Revision._revisionHistoryRegistryObject){if(window.localStorage){var revisionHistory=window.localStorage["revision-history"];try{WebInspector.Revision._revisionHistoryRegistryObject=revisionHistory?JSON.parse(revisionHistory):{};}catch(e){WebInspector.Revision._revisionHistoryRegistryObject={};}}else
3334 WebInspector.Revision._revisionHistoryRegistryObject={};}
3335 return WebInspector.Revision._revisionHistoryRegistryObject;}
3336 WebInspector.Revision.filterOutStaleRevisions=function()
3337 {if(!window.localStorage)
3338 return;var registry=WebInspector.Revision._revisionHistoryRegistry();var filteredRegistry={};for(var url in registry){var historyItems=registry[url];var filteredHistoryItems=[];for(var i=0;historyItems&&i<historyItems.length;++i){var historyItem=historyItems[i];if(historyItem.loaderId===WebInspector.resourceTreeModel.mainFrame.loaderId){filteredHistoryItems.push(historyItem);filteredRegistry[url]=filteredHistoryItems;}else
3339 delete window.localStorage[historyItem.key];}}
3340 WebInspector.Revision._revisionHistoryRegistryObject=filteredRegistry;function persist()
3341 {window.localStorage["revision-history"]=JSON.stringify(filteredRegistry);}
3342 setTimeout(persist,0);}
3343 WebInspector.Revision.prototype={get uiSourceCode()
3344 {return this._uiSourceCode;},get timestamp()
3345 {return this._timestamp;},get content()
3346 {return this._content||null;},revertToThis:function()
3347 {function revert(content)
3348 {if(this._uiSourceCode._content!==content)
3349 this._uiSourceCode.addRevision(content);}
3350 this.requestContent(revert.bind(this));},contentURL:function()
3351 {return this._uiSourceCode.originURL();},contentType:function()
3352 {return this._uiSourceCode.contentType();},requestContent:function(callback)
3353 {callback(this._content||"");},searchInContent:function(query,caseSensitive,isRegex,callback)
3354 {callback([]);},_persist:function()
3355 {if(this._uiSourceCode.project().type()===WebInspector.projectTypes.FileSystem)
3356 return;if(!window.localStorage)
3357 return;var url=this.contentURL();if(!url||url.startsWith("inspector://"))
3358 return;var loaderId=WebInspector.resourceTreeModel.mainFrame.loaderId;var timestamp=this.timestamp.getTime();var key="revision-history|"+url+"|"+loaderId+"|"+timestamp;var registry=WebInspector.Revision._revisionHistoryRegistry();var historyItems=registry[url];if(!historyItems){historyItems=[];registry[url]=historyItems;}
3359 historyItems.push({url:url,loaderId:loaderId,timestamp:timestamp,key:key});function persist()
3360 {window.localStorage[key]=this._content;window.localStorage["revision-history"]=JSON.stringify(registry);}
3361 setTimeout(persist.bind(this),0);}}
3362 WebInspector.CSSStyleModel=function(workspace)
3363 {this._workspace=workspace;this._pendingCommandsMajorState=[];this._styleLoader=new WebInspector.CSSStyleModel.ComputedStyleLoader(this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoRequested,this._undoRedoRequested,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted,this._undoRedoCompleted,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated,this._mainFrameCreatedOrNavigated,this);this._namedFlowCollections={};WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated,this._resetNamedFlowCollections,this);InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));CSSAgent.enable(this._wasEnabled.bind(this));this._resetStyleSheets();}
3364 WebInspector.CSSStyleModel.parseRuleMatchArrayPayload=function(matchArray)
3365 {if(!matchArray)
3366 return[];var result=[];for(var i=0;i<matchArray.length;++i)
3367 result.push(WebInspector.CSSRule.parsePayload(matchArray[i].rule,matchArray[i].matchingSelectors));return result;}
3368 WebInspector.CSSStyleModel.Events={ModelWasEnabled:"ModelWasEnabled",StyleSheetAdded:"StyleSheetAdded",StyleSheetChanged:"StyleSheetChanged",StyleSheetRemoved:"StyleSheetRemoved",MediaQueryResultChanged:"MediaQueryResultChanged",NamedFlowCreated:"NamedFlowCreated",NamedFlowRemoved:"NamedFlowRemoved",RegionLayoutUpdated:"RegionLayoutUpdated",RegionOversetChanged:"RegionOversetChanged"}
3369 WebInspector.CSSStyleModel.MediaTypes=["all","braille","embossed","handheld","print","projection","screen","speech","tty","tv"];WebInspector.CSSStyleModel.prototype={isEnabled:function()
3370 {return this._isEnabled;},_wasEnabled:function()
3371 {this._isEnabled=true;this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.ModelWasEnabled);},getMatchedStylesAsync:function(nodeId,needPseudo,needInherited,userCallback)
3372 {function callback(userCallback,error,matchedPayload,pseudoPayload,inheritedPayload)
3373 {if(error){if(userCallback)
3374 userCallback(null);return;}
3375 var result={};result.matchedCSSRules=WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(matchedPayload);result.pseudoElements=[];if(pseudoPayload){for(var i=0;i<pseudoPayload.length;++i){var entryPayload=pseudoPayload[i];result.pseudoElements.push({pseudoId:entryPayload.pseudoId,rules:WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(entryPayload.matches)});}}
3376 result.inherited=[];if(inheritedPayload){for(var i=0;i<inheritedPayload.length;++i){var entryPayload=inheritedPayload[i];var entry={};if(entryPayload.inlineStyle)
3377 entry.inlineStyle=WebInspector.CSSStyleDeclaration.parsePayload(entryPayload.inlineStyle);if(entryPayload.matchedCSSRules)
3378 entry.matchedCSSRules=WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(entryPayload.matchedCSSRules);result.inherited.push(entry);}}
3379 if(userCallback)
3380 userCallback(result);}
3381 CSSAgent.getMatchedStylesForNode(nodeId,needPseudo,needInherited,callback.bind(null,userCallback));},getComputedStyleAsync:function(nodeId,userCallback)
3382 {this._styleLoader.getComputedStyle(nodeId,userCallback);},getPlatformFontsForNode:function(nodeId,callback)
3383 {function platformFontsCallback(error,cssFamilyName,fonts)
3384 {if(error)
3385 callback(null,null);else
3386 callback(cssFamilyName,fonts);}
3387 CSSAgent.getPlatformFontsForNode(nodeId,platformFontsCallback);},getInlineStylesAsync:function(nodeId,userCallback)
3388 {function callback(userCallback,error,inlinePayload,attributesStylePayload)
3389 {if(error||!inlinePayload)
3390 userCallback(null,null);else
3391 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload),attributesStylePayload?WebInspector.CSSStyleDeclaration.parsePayload(attributesStylePayload):null);}
3392 CSSAgent.getInlineStylesForNode(nodeId,callback.bind(null,userCallback));},forcePseudoState:function(nodeId,forcedPseudoClasses,userCallback)
3393 {CSSAgent.forcePseudoState(nodeId,forcedPseudoClasses||[],userCallback);},getNamedFlowCollectionAsync:function(documentNodeId,userCallback)
3394 {var namedFlowCollection=this._namedFlowCollections[documentNodeId];if(namedFlowCollection){userCallback(namedFlowCollection);return;}
3395 function callback(userCallback,error,namedFlowPayload)
3396 {if(error||!namedFlowPayload)
3397 userCallback(null);else{var namedFlowCollection=new WebInspector.NamedFlowCollection(namedFlowPayload);this._namedFlowCollections[documentNodeId]=namedFlowCollection;userCallback(namedFlowCollection);}}
3398 CSSAgent.getNamedFlowCollection(documentNodeId,callback.bind(this,userCallback));},getFlowByNameAsync:function(documentNodeId,flowName,userCallback)
3399 {var namedFlowCollection=this._namedFlowCollections[documentNodeId];if(namedFlowCollection){userCallback(namedFlowCollection.flowByName(flowName));return;}
3400 function callback(userCallback,namedFlowCollection)
3401 {if(!namedFlowCollection)
3402 userCallback(null);else
3403 userCallback(namedFlowCollection.flowByName(flowName));}
3404 this.getNamedFlowCollectionAsync(documentNodeId,callback.bind(this,userCallback));},setRuleSelector:function(ruleId,nodeId,newSelector,successCallback,failureCallback)
3405 {function callback(nodeId,successCallback,failureCallback,newSelector,error,rulePayload)
3406 {this._pendingCommandsMajorState.pop();if(error){failureCallback();return;}
3407 WebInspector.domAgent.markUndoableState();this._computeMatchingSelectors(rulePayload,nodeId,successCallback,failureCallback);}
3408 this._pendingCommandsMajorState.push(true);CSSAgent.setRuleSelector(ruleId,newSelector,callback.bind(this,nodeId,successCallback,failureCallback,newSelector));},_computeMatchingSelectors:function(rulePayload,nodeId,successCallback,failureCallback)
3409 {var ownerDocumentId=this._ownerDocumentId(nodeId);if(!ownerDocumentId){failureCallback();return;}
3410 var rule=WebInspector.CSSRule.parsePayload(rulePayload);var matchingSelectors=[];var allSelectorsBarrier=new CallbackBarrier();for(var i=0;i<rule.selectors.length;++i){var selector=rule.selectors[i];var boundCallback=allSelectorsBarrier.createCallback(selectorQueried.bind(this,i,nodeId,matchingSelectors));WebInspector.domAgent.querySelectorAll(ownerDocumentId,selector.value,boundCallback);}
3411 allSelectorsBarrier.callWhenDone(function(){rule.matchingSelectors=matchingSelectors;successCallback(rule);});function selectorQueried(index,nodeId,matchingSelectors,matchingNodeIds)
3412 {if(!matchingNodeIds)
3413 return;if(matchingNodeIds.indexOf(nodeId)!==-1)
3414 matchingSelectors.push(index);}},addRule:function(nodeId,selector,successCallback,failureCallback)
3415 {function callback(error,rulePayload)
3416 {this._pendingCommandsMajorState.pop();if(error){failureCallback();}else{WebInspector.domAgent.markUndoableState();this._computeMatchingSelectors(rulePayload,nodeId,successCallback,failureCallback);}}
3417 this._pendingCommandsMajorState.push(true);CSSAgent.addRule(nodeId,selector,callback.bind(this));},mediaQueryResultChanged:function()
3418 {this._styleLoader.reset();this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged);},styleSheetHeaderForId:function(id)
3419 {return this._styleSheetIdToHeader[id];},styleSheetHeaders:function()
3420 {return Object.values(this._styleSheetIdToHeader);},_ownerDocumentId:function(nodeId)
3421 {var node=WebInspector.domAgent.nodeForId(nodeId);if(!node)
3422 return null;return node.ownerDocument?node.ownerDocument.id:null;},_fireStyleSheetChanged:function(styleSheetId)
3423 {this._styleLoader.reset();if(!this._pendingCommandsMajorState.length)
3424 return;var majorChange=this._pendingCommandsMajorState[this._pendingCommandsMajorState.length-1];if(!styleSheetId||!this.hasEventListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged))
3425 return;this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged,{styleSheetId:styleSheetId,majorChange:majorChange});},_styleSheetAdded:function(header)
3426 {console.assert(!this._styleSheetIdToHeader[header.styleSheetId]);var styleSheetHeader=new WebInspector.CSSStyleSheetHeader(header);this._styleSheetIdToHeader[header.styleSheetId]=styleSheetHeader;var url=styleSheetHeader.resourceURL();if(!this._styleSheetIdsForURL[url])
3427 this._styleSheetIdsForURL[url]={};var frameIdToStyleSheetIds=this._styleSheetIdsForURL[url];var styleSheetIds=frameIdToStyleSheetIds[styleSheetHeader.frameId];if(!styleSheetIds){styleSheetIds=[];frameIdToStyleSheetIds[styleSheetHeader.frameId]=styleSheetIds;}
3428 styleSheetIds.push(styleSheetHeader.id);this._styleLoader.reset();this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetAdded,styleSheetHeader);},_styleSheetRemoved:function(id)
3429 {var header=this._styleSheetIdToHeader[id];console.assert(header);delete this._styleSheetIdToHeader[id];var url=header.resourceURL();var frameIdToStyleSheetIds=this._styleSheetIdsForURL[url];frameIdToStyleSheetIds[header.frameId].remove(id);if(!frameIdToStyleSheetIds[header.frameId].length){delete frameIdToStyleSheetIds[header.frameId];if(!Object.keys(this._styleSheetIdsForURL[url]).length)
3430 delete this._styleSheetIdsForURL[url];}
3431 this._styleLoader.reset();this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,header);},styleSheetIdsForURL:function(url)
3432 {var frameIdToStyleSheetIds=this._styleSheetIdsForURL[url];if(!frameIdToStyleSheetIds)
3433 return[];var result=[];for(var frameId in frameIdToStyleSheetIds)
3434 result=result.concat(frameIdToStyleSheetIds[frameId]);return result;},styleSheetIdsByFrameIdForURL:function(url)
3435 {var styleSheetIdsForFrame=this._styleSheetIdsForURL[url];if(!styleSheetIdsForFrame)
3436 return{};return styleSheetIdsForFrame;},_namedFlowCreated:function(namedFlowPayload)
3437 {var namedFlow=WebInspector.NamedFlow.parsePayload(namedFlowPayload);var namedFlowCollection=this._namedFlowCollections[namedFlow.documentNodeId];if(!namedFlowCollection)
3438 return;namedFlowCollection._appendNamedFlow(namedFlow);this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated,namedFlow);},_namedFlowRemoved:function(documentNodeId,flowName)
3439 {var namedFlowCollection=this._namedFlowCollections[documentNodeId];if(!namedFlowCollection)
3440 return;namedFlowCollection._removeNamedFlow(flowName);this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved,{documentNodeId:documentNodeId,flowName:flowName});},_regionLayoutUpdated:function(namedFlowPayload)
3441 {var namedFlow=WebInspector.NamedFlow.parsePayload(namedFlowPayload);var namedFlowCollection=this._namedFlowCollections[namedFlow.documentNodeId];if(!namedFlowCollection)
3442 return;namedFlowCollection._appendNamedFlow(namedFlow);this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated,namedFlow);},_regionOversetChanged:function(namedFlowPayload)
3443 {var namedFlow=WebInspector.NamedFlow.parsePayload(namedFlowPayload);var namedFlowCollection=this._namedFlowCollections[namedFlow.documentNodeId];if(!namedFlowCollection)
3444 return;namedFlowCollection._appendNamedFlow(namedFlow);this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.RegionOversetChanged,namedFlow);},setStyleSheetText:function(styleSheetId,newText,majorChange,userCallback)
3445 {var header=this._styleSheetIdToHeader[styleSheetId];console.assert(header);this._pendingCommandsMajorState.push(majorChange);header.setContent(newText,callback.bind(this));function callback(error)
3446 {this._pendingCommandsMajorState.pop();if(!error&&majorChange)
3447 WebInspector.domAgent.markUndoableState();if(!error&&userCallback)
3448 userCallback(error);}},_undoRedoRequested:function()
3449 {this._pendingCommandsMajorState.push(true);},_undoRedoCompleted:function()
3450 {this._pendingCommandsMajorState.pop();},_mainFrameCreatedOrNavigated:function()
3451 {this._resetStyleSheets();},_resetStyleSheets:function()
3452 {this._styleSheetIdsForURL={};this._styleSheetIdToHeader={};},_resetNamedFlowCollections:function()
3453 {this._namedFlowCollections={};},updateLocations:function()
3454 {var headers=Object.values(this._styleSheetIdToHeader);for(var i=0;i<headers.length;++i)
3455 headers[i].updateLocations();},createLiveLocation:function(styleSheetId,rawLocation,updateDelegate)
3456 {if(!rawLocation)
3457 return null;var header=styleSheetId?this.styleSheetHeaderForId(styleSheetId):null;return new WebInspector.CSSStyleModel.LiveLocation(this,header,rawLocation,updateDelegate);},rawLocationToUILocation:function(rawLocation)
3458 {var frameIdToSheetIds=this._styleSheetIdsForURL[rawLocation.url];if(!frameIdToSheetIds)
3459 return null;var styleSheetIds=[];for(var frameId in frameIdToSheetIds)
3460 styleSheetIds=styleSheetIds.concat(frameIdToSheetIds[frameId]);var uiLocation;for(var i=0;!uiLocation&&i<styleSheetIds.length;++i){var header=this.styleSheetHeaderForId(styleSheetIds[i]);console.assert(header);uiLocation=header.rawLocationToUILocation(rawLocation.lineNumber,rawLocation.columnNumber);}
3461 return uiLocation||null;},__proto__:WebInspector.Object.prototype}
3462 WebInspector.CSSStyleModel.LiveLocation=function(model,header,rawLocation,updateDelegate)
3463 {WebInspector.LiveLocation.call(this,rawLocation,updateDelegate);this._model=model;if(!header)
3464 this._clearStyleSheet();else
3465 this._setStyleSheet(header);}
3466 WebInspector.CSSStyleModel.LiveLocation.prototype={_styleSheetAdded:function(event)
3467 {console.assert(!this._header);var header=(event.data);if(header.sourceURL&&header.sourceURL===this.rawLocation().url)
3468 this._setStyleSheet(header);},_styleSheetRemoved:function(event)
3469 {console.assert(this._header);var header=(event.data);if(this._header!==header)
3470 return;this._header._removeLocation(this);this._clearStyleSheet();},_setStyleSheet:function(header)
3471 {this._header=header;this._header.addLiveLocation(this);this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._model.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);},_clearStyleSheet:function()
3472 {delete this._header;this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);this._model.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);},uiLocation:function()
3473 {var cssLocation=(this.rawLocation());if(this._header)
3474 return this._header.rawLocationToUILocation(cssLocation.lineNumber,cssLocation.columnNumber);var uiSourceCode=WebInspector.workspace.uiSourceCodeForURL(cssLocation.url);if(!uiSourceCode)
3475 return null;return new WebInspector.UILocation(uiSourceCode,cssLocation.lineNumber,cssLocation.columnNumber);},dispose:function()
3476 {WebInspector.LiveLocation.prototype.dispose.call(this);this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);},__proto__:WebInspector.LiveLocation.prototype}
3477 WebInspector.CSSLocation=function(url,lineNumber,columnNumber)
3478 {this.url=url;this.lineNumber=lineNumber;this.columnNumber=columnNumber||0;}
3479 WebInspector.CSSStyleDeclaration=function(payload)
3480 {this.id=payload.styleId;this.width=payload.width;this.height=payload.height;this.range=payload.range;this._shorthandValues=WebInspector.CSSStyleDeclaration.buildShorthandValueMap(payload.shorthandEntries);this._livePropertyMap={};this._allProperties=[];this.__disabledProperties={};var payloadPropertyCount=payload.cssProperties.length;var propertyIndex=0;for(var i=0;i<payloadPropertyCount;++i){var property=WebInspector.CSSProperty.parsePayload(this,i,payload.cssProperties[i]);this._allProperties.push(property);if(property.disabled)
3481 this.__disabledProperties[i]=property;if(!property.active&&!property.styleBased)
3482 continue;var name=property.name;this[propertyIndex]=name;this._livePropertyMap[name]=property;++propertyIndex;}
3483 this.length=propertyIndex;if("cssText"in payload)
3484 this.cssText=payload.cssText;}
3485 WebInspector.CSSStyleDeclaration.buildShorthandValueMap=function(shorthandEntries)
3486 {var result={};for(var i=0;i<shorthandEntries.length;++i)
3487 result[shorthandEntries[i].name]=shorthandEntries[i].value;return result;}
3488 WebInspector.CSSStyleDeclaration.parsePayload=function(payload)
3489 {return new WebInspector.CSSStyleDeclaration(payload);}
3490 WebInspector.CSSStyleDeclaration.parseComputedStylePayload=function(payload)
3491 {var newPayload=({cssProperties:[],shorthandEntries:[],width:"",height:""});if(payload)
3492 newPayload.cssProperties=(payload);return new WebInspector.CSSStyleDeclaration(newPayload);}
3493 WebInspector.CSSStyleDeclaration.prototype={get allProperties()
3494 {return this._allProperties;},getLiveProperty:function(name)
3495 {return this._livePropertyMap[name]||null;},getPropertyValue:function(name)
3496 {var property=this._livePropertyMap[name];return property?property.value:"";},getPropertyPriority:function(name)
3497 {var property=this._livePropertyMap[name];return property?property.priority:"";},isPropertyImplicit:function(name)
3498 {var property=this._livePropertyMap[name];return property?property.implicit:"";},longhandProperties:function(name)
3499 {var longhands=WebInspector.CSSMetadata.cssPropertiesMetainfo.longhands(name);var result=[];for(var i=0;longhands&&i<longhands.length;++i){var property=this._livePropertyMap[longhands[i]];if(property)
3500 result.push(property);}
3501 return result;},shorthandValue:function(shorthandProperty)
3502 {return this._shorthandValues[shorthandProperty];},propertyAt:function(index)
3503 {return(index<this.allProperties.length)?this.allProperties[index]:null;},pastLastSourcePropertyIndex:function()
3504 {for(var i=this.allProperties.length-1;i>=0;--i){var property=this.allProperties[i];if(property.active||property.disabled)
3505 return i+1;}
3506 return 0;},newBlankProperty:function(index)
3507 {index=(typeof index==="undefined")?this.pastLastSourcePropertyIndex():index;return new WebInspector.CSSProperty(this,index,"","","","active",true,false,"");},insertPropertyAt:function(index,name,value,userCallback)
3508 {function callback(error,payload)
3509 {WebInspector.cssModel._pendingCommandsMajorState.pop();if(!userCallback)
3510 return;if(error){console.error(error);userCallback(null);}else
3511 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));}
3512 if(!this.id)
3513 throw"No style id";WebInspector.cssModel._pendingCommandsMajorState.push(true);CSSAgent.setPropertyText(this.id,index,name+": "+value+";",false,callback.bind(this));},appendProperty:function(name,value,userCallback)
3514 {this.insertPropertyAt(this.allProperties.length,name,value,userCallback);},setText:function(text,userCallback)
3515 {function callback(error,payload)
3516 {WebInspector.cssModel._pendingCommandsMajorState.pop();if(!userCallback)
3517 return;if(error){console.error(error);userCallback(null);}else
3518 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));}
3519 if(!this.id)
3520 throw"No style id";if(typeof this.cssText==="undefined"){userCallback(null);return;}
3521 WebInspector.cssModel._pendingCommandsMajorState.push(true);CSSAgent.setStyleText(this.id,text,callback);}}
3522 WebInspector.CSSRule=function(payload,matchingSelectors)
3523 {this.id=payload.ruleId;if(matchingSelectors)
3524 this.matchingSelectors=matchingSelectors;this.selectors=payload.selectorList.selectors;this.selectorText=this.selectors.select("value").join(", ");var firstRange=this.selectors[0].range;if(firstRange){var lastRange=this.selectors.peekLast().range;this.selectorRange=new WebInspector.TextRange(firstRange.startLine,firstRange.startColumn,lastRange.endLine,lastRange.endColumn);}
3525 this.sourceURL=payload.sourceURL;this.origin=payload.origin;this.style=WebInspector.CSSStyleDeclaration.parsePayload(payload.style);this.style.parentRule=this;if(payload.media)
3526 this.media=WebInspector.CSSMedia.parseMediaArrayPayload(payload.media);this._setRawLocationAndFrameId();}
3527 WebInspector.CSSRule.parsePayload=function(payload,matchingIndices)
3528 {return new WebInspector.CSSRule(payload,matchingIndices);}
3529 WebInspector.CSSRule.prototype={_setRawLocationAndFrameId:function()
3530 {if(!this.id)
3531 return;var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.id.styleSheetId);this.frameId=styleSheetHeader.frameId;var url=styleSheetHeader.resourceURL();if(!url)
3532 return;this.rawLocation=new WebInspector.CSSLocation(url,this.lineNumberInSource(0),this.columnNumberInSource(0));},resourceURL:function()
3533 {if(!this.id)
3534 return"";var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.id.styleSheetId);return styleSheetHeader.resourceURL();},lineNumberInSource:function(selectorIndex)
3535 {var selector=this.selectors[selectorIndex];if(!selector||!selector.range)
3536 return 0;var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.id.styleSheetId);return styleSheetHeader.lineNumberInSource(selector.range.startLine);},columnNumberInSource:function(selectorIndex)
3537 {var selector=this.selectors[selectorIndex];if(!selector||!selector.range)
3538 return undefined;var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.id.styleSheetId);console.assert(styleSheetHeader);return styleSheetHeader.columnNumberInSource(selector.range.startLine,selector.range.startColumn);},get isUserAgent()
3539 {return this.origin==="user-agent";},get isUser()
3540 {return this.origin==="user";},get isViaInspector()
3541 {return this.origin==="inspector";},get isRegular()
3542 {return this.origin==="regular";}}
3543 WebInspector.CSSProperty=function(ownerStyle,index,name,value,priority,status,parsedOk,implicit,text,range)
3544 {this.ownerStyle=ownerStyle;this.index=index;this.name=name;this.value=value;this.priority=priority;this.status=status;this.parsedOk=parsedOk;this.implicit=implicit;this.text=text;this.range=range;}
3545 WebInspector.CSSProperty.parsePayload=function(ownerStyle,index,payload)
3546 {var result=new WebInspector.CSSProperty(ownerStyle,index,payload.name,payload.value,payload.priority||"",payload.status||"style",("parsedOk"in payload)?!!payload.parsedOk:true,!!payload.implicit,payload.text,payload.range);return result;}
3547 WebInspector.CSSProperty.prototype={get propertyText()
3548 {if(this.text!==undefined)
3549 return this.text;if(this.name==="")
3550 return"";return this.name+": "+this.value+(this.priority?" !"+this.priority:"")+";";},get isLive()
3551 {return this.active||this.styleBased;},get active()
3552 {return this.status==="active";},get styleBased()
3553 {return this.status==="style";},get inactive()
3554 {return this.status==="inactive";},get disabled()
3555 {return this.status==="disabled";},setText:function(propertyText,majorChange,overwrite,userCallback)
3556 {function enabledCallback(style)
3557 {if(userCallback)
3558 userCallback(style);}
3559 function callback(error,stylePayload)
3560 {WebInspector.cssModel._pendingCommandsMajorState.pop();if(!error){if(majorChange)
3561 WebInspector.domAgent.markUndoableState();this.text=propertyText;var style=WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);var newProperty=style.allProperties[this.index];if(newProperty&&this.disabled&&!propertyText.match(/^\s*$/)){newProperty.setDisabled(false,enabledCallback);return;}
3562 if(userCallback)
3563 userCallback(style);}else{if(userCallback)
3564 userCallback(null);}}
3565 if(!this.ownerStyle)
3566 throw"No ownerStyle for property";if(!this.ownerStyle.id)
3567 throw"No owner style id";WebInspector.cssModel._pendingCommandsMajorState.push(majorChange);CSSAgent.setPropertyText(this.ownerStyle.id,this.index,propertyText,overwrite,callback.bind(this));},setValue:function(newValue,majorChange,overwrite,userCallback)
3568 {var text=this.name+": "+newValue+(this.priority?" !"+this.priority:"")+";"
3569 this.setText(text,majorChange,overwrite,userCallback);},setDisabled:function(disabled,userCallback)
3570 {if(!this.ownerStyle&&userCallback)
3571 userCallback(null);if(disabled===this.disabled&&userCallback)
3572 userCallback(this.ownerStyle);function callback(error,stylePayload)
3573 {WebInspector.cssModel._pendingCommandsMajorState.pop();if(error){if(userCallback)
3574 userCallback(null);return;}
3575 WebInspector.domAgent.markUndoableState();if(userCallback){var style=WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);userCallback(style);}}
3576 if(!this.ownerStyle.id)
3577 throw"No owner style id";WebInspector.cssModel._pendingCommandsMajorState.push(false);CSSAgent.toggleProperty(this.ownerStyle.id,this.index,disabled,callback.bind(this));},uiLocation:function(forName)
3578 {if(!this.range||!this.ownerStyle||!this.ownerStyle.parentRule)
3579 return null;var url=this.ownerStyle.parentRule.resourceURL();if(!url)
3580 return null;var range=this.range;var line=forName?range.startLine:range.endLine;var column=forName?range.startColumn:range.endColumn-(this.text&&this.text.endsWith(";")?2:1);var rawLocation=new WebInspector.CSSLocation(url,line,column);return WebInspector.cssModel.rawLocationToUILocation(rawLocation);}}
3581 WebInspector.CSSMedia=function(payload)
3582 {this.text=payload.text;this.source=payload.source;this.sourceURL=payload.sourceURL||"";this.range=payload.range?WebInspector.TextRange.fromObject(payload.range):null;this.parentStyleSheetId=payload.parentStyleSheetId;}
3583 WebInspector.CSSMedia.Source={LINKED_SHEET:"linkedSheet",INLINE_SHEET:"inlineSheet",MEDIA_RULE:"mediaRule",IMPORT_RULE:"importRule"};WebInspector.CSSMedia.parsePayload=function(payload)
3584 {return new WebInspector.CSSMedia(payload);}
3585 WebInspector.CSSMedia.parseMediaArrayPayload=function(payload)
3586 {var result=[];for(var i=0;i<payload.length;++i)
3587 result.push(WebInspector.CSSMedia.parsePayload(payload[i]));return result;}
3588 WebInspector.CSSMedia.prototype={lineNumberInSource:function()
3589 {if(!this.range)
3590 return undefined;var header=this.header();if(!header)
3591 return undefined;return header.lineNumberInSource(this.range.startLine);},columnNumberInSource:function()
3592 {if(!this.range)
3593 return undefined;var header=this.header();if(!header)
3594 return undefined;return header.columnNumberInSource(this.range.startLine,this.range.startColumn);},header:function()
3595 {return this.parentStyleSheetId?WebInspector.cssModel.styleSheetHeaderForId(this.parentStyleSheetId):null;}}
3596 WebInspector.CSSStyleSheetHeader=function(payload)
3597 {this.id=payload.styleSheetId;this.frameId=payload.frameId;this.sourceURL=payload.sourceURL;this.hasSourceURL=!!payload.hasSourceURL;this.sourceMapURL=payload.sourceMapURL;this.origin=payload.origin;this.title=payload.title;this.disabled=payload.disabled;this.isInline=payload.isInline;this.startLine=payload.startLine;this.startColumn=payload.startColumn;this._locations=new Set();this._sourceMappings=[];}
3598 WebInspector.CSSStyleSheetHeader.prototype={resourceURL:function()
3599 {return this.origin==="inspector"?this._viaInspectorResourceURL():this.sourceURL;},addLiveLocation:function(location)
3600 {this._locations.add(location);location.update();},updateLocations:function()
3601 {var items=this._locations.items();for(var i=0;i<items.length;++i)
3602 items[i].update();},_removeLocation:function(location)
3603 {this._locations.remove(location);},rawLocationToUILocation:function(lineNumber,columnNumber)
3604 {var uiLocation;var rawLocation=new WebInspector.CSSLocation(this.resourceURL(),lineNumber,columnNumber);for(var i=this._sourceMappings.length-1;!uiLocation&&i>=0;--i)
3605 uiLocation=this._sourceMappings[i].rawLocationToUILocation(rawLocation);return uiLocation?uiLocation.uiSourceCode.overrideLocation(uiLocation):null;},pushSourceMapping:function(sourceMapping)
3606 {this._sourceMappings.push(sourceMapping);this.updateLocations();},_key:function()
3607 {return this.frameId+":"+this.resourceURL();},_viaInspectorResourceURL:function()
3608 {var frame=WebInspector.resourceTreeModel.frameForId(this.frameId);console.assert(frame);var parsedURL=new WebInspector.ParsedURL(frame.url);var fakeURL="inspector://"+parsedURL.host+parsedURL.folderPathComponents;if(!fakeURL.endsWith("/"))
3609 fakeURL+="/";fakeURL+="inspector-stylesheet";return fakeURL;},lineNumberInSource:function(lineNumberInStyleSheet)
3610 {return this.startLine+lineNumberInStyleSheet;},columnNumberInSource:function(lineNumberInStyleSheet,columnNumberInStyleSheet)
3611 {return(lineNumberInStyleSheet?0:this.startColumn)+columnNumberInStyleSheet;},contentURL:function()
3612 {return this.resourceURL();},contentType:function()
3613 {return WebInspector.resourceTypes.Stylesheet;},_trimSourceURL:function(text)
3614 {var sourceURLRegex=/\n[\040\t]*\/\*[#@][\040\t]sourceURL=[\040\t]*([^\s]*)[\040\t]*\*\/[\040\t]*$/mg;return text.replace(sourceURLRegex,"");},requestContent:function(callback)
3615 {CSSAgent.getStyleSheetText(this.id,textCallback.bind(this));function textCallback(error,text)
3616 {if(error){WebInspector.log("Failed to get text for stylesheet "+this.id+": "+error);text="";}
3617 text=this._trimSourceURL(text);callback(text);}},searchInContent:function(query,caseSensitive,isRegex,callback)
3618 {function performSearch(content)
3619 {callback(WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex));}
3620 this.requestContent(performSearch);},setContent:function(newText,callback)
3621 {newText=this._trimSourceURL(newText);if(this.hasSourceURL)
3622 newText+="\n/*# sourceURL="+this.sourceURL+" */";CSSAgent.setStyleSheetText(this.id,newText,callback);},}
3623 WebInspector.CSSStyleSheet=function(styleSheetId,payload)
3624 {this.id=styleSheetId;this.rules=[];this.styles={};for(var i=0;i<payload.length;++i){var rule=WebInspector.CSSRule.parsePayload(payload[i]);this.rules.push(rule);if(rule.style)
3625 this.styles[rule.style.id]=rule.style;}}
3626 WebInspector.CSSStyleSheet.createForId=function(styleSheetId,userCallback)
3627 {function callback(error,styleSheetPayload)
3628 {if(error)
3629 userCallback(null);else
3630 userCallback(new WebInspector.CSSStyleSheet(styleSheetId,styleSheetPayload.rules));}
3631 CSSAgent.getStyleSheet(styleSheetId,callback);}
3632 WebInspector.CSSDispatcher=function(cssModel)
3633 {this._cssModel=cssModel;}
3634 WebInspector.CSSDispatcher.prototype={mediaQueryResultChanged:function()
3635 {this._cssModel.mediaQueryResultChanged();},styleSheetChanged:function(styleSheetId)
3636 {this._cssModel._fireStyleSheetChanged(styleSheetId);},styleSheetAdded:function(header)
3637 {this._cssModel._styleSheetAdded(header);},styleSheetRemoved:function(id)
3638 {this._cssModel._styleSheetRemoved(id);},namedFlowCreated:function(namedFlowPayload)
3639 {this._cssModel._namedFlowCreated(namedFlowPayload);},namedFlowRemoved:function(documentNodeId,flowName)
3640 {this._cssModel._namedFlowRemoved(documentNodeId,flowName);},regionLayoutUpdated:function(namedFlowPayload)
3641 {this._cssModel._regionLayoutUpdated(namedFlowPayload);},regionOversetChanged:function(namedFlowPayload)
3642 {this._cssModel._regionOversetChanged(namedFlowPayload);}}
3643 WebInspector.NamedFlow=function(payload)
3644 {this.documentNodeId=payload.documentNodeId;this.name=payload.name;this.overset=payload.overset;this.content=payload.content;this.regions=payload.regions;}
3645 WebInspector.NamedFlow.parsePayload=function(payload)
3646 {return new WebInspector.NamedFlow(payload);}
3647 WebInspector.NamedFlowCollection=function(payload)
3648 {this.namedFlowMap={};for(var i=0;i<payload.length;++i){var namedFlow=WebInspector.NamedFlow.parsePayload(payload[i]);this.namedFlowMap[namedFlow.name]=namedFlow;}}
3649 WebInspector.NamedFlowCollection.prototype={_appendNamedFlow:function(namedFlow)
3650 {this.namedFlowMap[namedFlow.name]=namedFlow;},_removeNamedFlow:function(flowName)
3651 {delete this.namedFlowMap[flowName];},flowByName:function(flowName)
3652 {var namedFlow=this.namedFlowMap[flowName];if(!namedFlow)
3653 return null;return namedFlow;}}
3654 WebInspector.CSSStyleModel.ComputedStyleLoader=function(cssModel)
3655 {this._cssModel=cssModel;this._nodeIdToCallbackData={};}
3656 WebInspector.CSSStyleModel.ComputedStyleLoader.prototype={reset:function()
3657 {for(var nodeId in this._nodeIdToCallbackData){var callbacks=this._nodeIdToCallbackData[nodeId];for(var i=0;i<callbacks.length;++i)
3658 callbacks[i](null);}
3659 this._nodeIdToCallbackData={};},getComputedStyle:function(nodeId,userCallback)
3660 {if(this._nodeIdToCallbackData[nodeId]){this._nodeIdToCallbackData[nodeId].push(userCallback);return;}
3661 this._nodeIdToCallbackData[nodeId]=[userCallback];CSSAgent.getComputedStyleForNode(nodeId,resultCallback.bind(this,nodeId));function resultCallback(nodeId,error,computedPayload)
3662 {var computedStyle=(error||!computedPayload)?null:WebInspector.CSSStyleDeclaration.parseComputedStylePayload(computedPayload);var callbacks=this._nodeIdToCallbackData[nodeId];if(!callbacks)
3663 return;delete this._nodeIdToCallbackData[nodeId];for(var i=0;i<callbacks.length;++i)
3664 callbacks[i](computedStyle);}}}
3665 WebInspector.cssModel;WebInspector.NetworkManager=function()
3666 {WebInspector.Object.call(this);this._dispatcher=new WebInspector.NetworkDispatcher(this);if(WebInspector.settings.cacheDisabled.get())
3667 NetworkAgent.setCacheDisabled(true);NetworkAgent.enable();WebInspector.settings.cacheDisabled.addChangeListener(this._cacheDisabledSettingChanged,this);}
3668 WebInspector.NetworkManager.EventTypes={RequestStarted:"RequestStarted",RequestUpdated:"RequestUpdated",RequestFinished:"RequestFinished",RequestUpdateDropped:"RequestUpdateDropped"}
3669 WebInspector.NetworkManager._MIMETypes={"text/html":{"document":true},"text/xml":{"document":true},"text/plain":{"document":true},"application/xhtml+xml":{"document":true},"text/css":{"stylesheet":true},"text/xsl":{"stylesheet":true},"image/jpg":{"image":true},"image/jpeg":{"image":true},"image/pjpeg":{"image":true},"image/png":{"image":true},"image/gif":{"image":true},"image/bmp":{"image":true},"image/svg+xml":{"image":true,"font":true,"document":true},"image/vnd.microsoft.icon":{"image":true},"image/webp":{"image":true},"image/x-icon":{"image":true},"image/x-xbitmap":{"image":true},"font/ttf":{"font":true},"font/otf":{"font":true},"font/woff":{"font":true},"font/woff2":{"font":true},"font/truetype":{"font":true},"font/opentype":{"font":true},"application/octet-stream":{"font":true,"image":true},"application/font-woff":{"font":true},"application/x-font-woff":{"font":true},"application/x-font-type1":{"font":true},"application/x-font-ttf":{"font":true},"application/x-truetype-font":{"font":true},"text/javascript":{"script":true},"text/ecmascript":{"script":true},"application/javascript":{"script":true},"application/ecmascript":{"script":true},"application/x-javascript":{"script":true},"application/json":{"script":true},"text/javascript1.1":{"script":true},"text/javascript1.2":{"script":true},"text/javascript1.3":{"script":true},"text/jscript":{"script":true},"text/livescript":{"script":true},}
3670 WebInspector.NetworkManager.prototype={inflightRequestForURL:function(url)
3671 {return this._dispatcher._inflightRequestsByURL[url];},_cacheDisabledSettingChanged:function(event)
3672 {var enabled=(event.data);NetworkAgent.setCacheDisabled(enabled);},__proto__:WebInspector.Object.prototype}
3673 WebInspector.NetworkDispatcher=function(manager)
3674 {this._manager=manager;this._inflightRequestsById={};this._inflightRequestsByURL={};InspectorBackend.registerNetworkDispatcher(this);}
3675 WebInspector.NetworkDispatcher.prototype={_headersMapToHeadersArray:function(headersMap)
3676 {var result=[];for(var name in headersMap){var values=headersMap[name].split("\n");for(var i=0;i<values.length;++i)
3677 result.push({name:name,value:values[i]});}
3678 return result;},_updateNetworkRequestWithRequest:function(networkRequest,request)
3679 {networkRequest.requestMethod=request.method;networkRequest.setRequestHeaders(this._headersMapToHeadersArray(request.headers));networkRequest.requestFormData=request.postData;},_updateNetworkRequestWithResponse:function(networkRequest,response)
3680 {if(!response)
3681 return;if(response.url&&networkRequest.url!==response.url)
3682 networkRequest.url=response.url;networkRequest.mimeType=response.mimeType;networkRequest.statusCode=response.status;networkRequest.statusText=response.statusText;networkRequest.responseHeaders=this._headersMapToHeadersArray(response.headers);if(response.headersText)
3683 networkRequest.responseHeadersText=response.headersText;if(response.requestHeaders){networkRequest.setRequestHeaders(this._headersMapToHeadersArray(response.requestHeaders));networkRequest.setRequestHeadersText(response.requestHeadersText||"");}
3684 networkRequest.connectionReused=response.connectionReused;networkRequest.connectionId=response.connectionId;if(response.fromDiskCache)
3685 networkRequest.cached=true;else
3686 networkRequest.timing=response.timing;if(!this._mimeTypeIsConsistentWithType(networkRequest)){WebInspector.console.addMessage(WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.Network,WebInspector.ConsoleMessage.MessageLevel.Log,WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s: \"%s\".",networkRequest.type.title(),networkRequest.mimeType,networkRequest.url),WebInspector.ConsoleMessage.MessageType.Log,"",0,0,1,[],undefined,networkRequest.requestId));}},_mimeTypeIsConsistentWithType:function(networkRequest)
3687 {if(networkRequest.hasErrorStatusCode()||networkRequest.statusCode===304||networkRequest.statusCode===204)
3688 return true;if(typeof networkRequest.type==="undefined"||networkRequest.type===WebInspector.resourceTypes.Other||networkRequest.type===WebInspector.resourceTypes.XHR||networkRequest.type===WebInspector.resourceTypes.WebSocket)
3689 return true;if(!networkRequest.mimeType)
3690 return true;if(networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes)
3691 return networkRequest.type.name()in WebInspector.NetworkManager._MIMETypes[networkRequest.mimeType];return false;},_isNull:function(response)
3692 {if(!response)
3693 return true;return!response.status&&!response.mimeType&&(!response.headers||!Object.keys(response.headers).length);},requestWillBeSent:function(requestId,frameId,loaderId,documentURL,request,time,initiator,redirectResponse)
3694 {var networkRequest=this._inflightRequestsById[requestId];if(networkRequest){if(!redirectResponse)
3695 return;this.responseReceived(requestId,frameId,loaderId,time,PageAgent.ResourceType.Other,redirectResponse);networkRequest=this._appendRedirect(requestId,time,request.url);}else
3696 networkRequest=this._createNetworkRequest(requestId,frameId,loaderId,request.url,documentURL,initiator);networkRequest.hasNetworkData=true;this._updateNetworkRequestWithRequest(networkRequest,request);networkRequest.startTime=time;this._startNetworkRequest(networkRequest);},requestServedFromCache:function(requestId)
3697 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3698 return;networkRequest.cached=true;},responseReceived:function(requestId,frameId,loaderId,time,resourceType,response)
3699 {if(this._isNull(response))
3700 return;var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest){var eventData={};eventData.url=response.url;eventData.frameId=frameId;eventData.loaderId=loaderId;eventData.resourceType=resourceType;eventData.mimeType=response.mimeType;this._manager.dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestUpdateDropped,eventData);return;}
3701 networkRequest.responseReceivedTime=time;networkRequest.type=WebInspector.resourceTypes[resourceType];this._updateNetworkRequestWithResponse(networkRequest,response);this._updateNetworkRequest(networkRequest);},dataReceived:function(requestId,time,dataLength,encodedDataLength)
3702 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3703 return;networkRequest.resourceSize+=dataLength;if(encodedDataLength!=-1)
3704 networkRequest.increaseTransferSize(encodedDataLength);networkRequest.endTime=time;this._updateNetworkRequest(networkRequest);},loadingFinished:function(requestId,finishTime)
3705 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3706 return;this._finishNetworkRequest(networkRequest,finishTime);},loadingFailed:function(requestId,time,localizedDescription,canceled)
3707 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3708 return;networkRequest.failed=true;networkRequest.canceled=canceled;networkRequest.localizedFailDescription=localizedDescription;this._finishNetworkRequest(networkRequest,time);},webSocketCreated:function(requestId,requestURL)
3709 {var networkRequest=new WebInspector.NetworkRequest(requestId,requestURL,"","","");networkRequest.type=WebInspector.resourceTypes.WebSocket;this._startNetworkRequest(networkRequest);},webSocketWillSendHandshakeRequest:function(requestId,time,request)
3710 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3711 return;networkRequest.requestMethod="GET";networkRequest.setRequestHeaders(this._headersMapToHeadersArray(request.headers));networkRequest.startTime=time;this._updateNetworkRequest(networkRequest);},webSocketHandshakeResponseReceived:function(requestId,time,response)
3712 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3713 return;networkRequest.statusCode=response.status;networkRequest.statusText=response.statusText;networkRequest.responseHeaders=this._headersMapToHeadersArray(response.headers);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketFrameReceived:function(requestId,time,response)
3714 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3715 return;networkRequest.addFrame(response,time);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketFrameSent:function(requestId,time,response)
3716 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3717 return;networkRequest.addFrame(response,time,true);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketFrameError:function(requestId,time,errorMessage)
3718 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3719 return;networkRequest.addFrameError(errorMessage,time);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketClosed:function(requestId,time)
3720 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3721 return;this._finishNetworkRequest(networkRequest,time);},_appendRedirect:function(requestId,time,redirectURL)
3722 {var originalNetworkRequest=this._inflightRequestsById[requestId];var previousRedirects=originalNetworkRequest.redirects||[];originalNetworkRequest.requestId="redirected:"+requestId+"."+previousRedirects.length;delete originalNetworkRequest.redirects;if(previousRedirects.length>0)
3723 originalNetworkRequest.redirectSource=previousRedirects[previousRedirects.length-1];this._finishNetworkRequest(originalNetworkRequest,time);var newNetworkRequest=this._createNetworkRequest(requestId,originalNetworkRequest.frameId,originalNetworkRequest.loaderId,redirectURL,originalNetworkRequest.documentURL,originalNetworkRequest.initiator);newNetworkRequest.redirects=previousRedirects.concat(originalNetworkRequest);return newNetworkRequest;},_startNetworkRequest:function(networkRequest)
3724 {this._inflightRequestsById[networkRequest.requestId]=networkRequest;this._inflightRequestsByURL[networkRequest.url]=networkRequest;this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestStarted,networkRequest);},_updateNetworkRequest:function(networkRequest)
3725 {this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestUpdated,networkRequest);},_finishNetworkRequest:function(networkRequest,finishTime)
3726 {networkRequest.endTime=finishTime;networkRequest.finished=true;this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestFinished,networkRequest);delete this._inflightRequestsById[networkRequest.requestId];delete this._inflightRequestsByURL[networkRequest.url];},_dispatchEventToListeners:function(eventType,networkRequest)
3727 {this._manager.dispatchEventToListeners(eventType,networkRequest);},_createNetworkRequest:function(requestId,frameId,loaderId,url,documentURL,initiator)
3728 {var networkRequest=new WebInspector.NetworkRequest(requestId,url,documentURL,frameId,loaderId);networkRequest.initiator=initiator;return networkRequest;}}
3729 WebInspector.networkManager;WebInspector.NetworkLog=function()
3730 {this._requests=[];this._requestForId={};WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestStarted,this._onRequestStarted,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._onLoad,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded,this._onDOMContentLoaded,this);}
3731 WebInspector.NetworkLog.prototype={get requests()
3732 {return this._requests;},requestForURL:function(url)
3733 {for(var i=0;i<this._requests.length;++i){if(this._requests[i].url===url)
3734 return this._requests[i];}
3735 return null;},pageLoadForRequest:function(request)
3736 {return request.__page;},_onMainFrameNavigated:function(event)
3737 {var mainFrame=event.data;this._currentPageLoad=null;var oldRequests=this._requests.splice(0,this._requests.length);this._requestForId={};for(var i=0;i<oldRequests.length;++i){var request=oldRequests[i];if(request.loaderId===mainFrame.loaderId){if(!this._currentPageLoad)
3738 this._currentPageLoad=new WebInspector.PageLoad(request);this._requests.push(request);this._requestForId[request.requestId]=request;request.__page=this._currentPageLoad;}}},_onRequestStarted:function(event)
3739 {var request=(event.data);this._requests.push(request);this._requestForId[request.requestId]=request;request.__page=this._currentPageLoad;},_onDOMContentLoaded:function(event)
3740 {if(this._currentPageLoad)
3741 this._currentPageLoad.contentLoadTime=event.data;},_onLoad:function(event)
3742 {if(this._currentPageLoad)
3743 this._currentPageLoad.loadTime=event.data;},requestForId:function(requestId)
3744 {return this._requestForId[requestId];}}
3745 WebInspector.networkLog;WebInspector.PageLoad=function(mainRequest)
3746 {this.id=++WebInspector.PageLoad._lastIdentifier;this.url=mainRequest.url;this.startTime=mainRequest.startTime;}
3747 WebInspector.PageLoad._lastIdentifier=0;WebInspector.ResourceTreeModel=function(networkManager)
3748 {networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished,this._onRequestFinished,this);networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestUpdateDropped,this._onRequestUpdateDropped,this);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._consoleMessageAdded,this);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated,this._consoleMessageAdded,this);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);PageAgent.enable();this._fetchResourceTree();InspectorBackend.registerPageDispatcher(new WebInspector.PageDispatcher(this));this._pendingConsoleMessages={};this._securityOriginFrameCount={};}
3749 WebInspector.ResourceTreeModel.EventTypes={FrameAdded:"FrameAdded",FrameNavigated:"FrameNavigated",FrameDetached:"FrameDetached",FrameResized:"FrameResized",MainFrameNavigated:"MainFrameNavigated",MainFrameCreatedOrNavigated:"MainFrameCreatedOrNavigated",ResourceAdded:"ResourceAdded",WillLoadCachedResources:"WillLoadCachedResources",CachedResourcesLoaded:"CachedResourcesLoaded",DOMContentLoaded:"DOMContentLoaded",Load:"Load",WillReloadPage:"WillReloadPage",InspectedURLChanged:"InspectedURLChanged",SecurityOriginAdded:"SecurityOriginAdded",SecurityOriginRemoved:"SecurityOriginRemoved",ScreencastFrame:"ScreencastFrame",ScreencastVisibilityChanged:"ScreencastVisibilityChanged"}
3750 WebInspector.ResourceTreeModel.prototype={_fetchResourceTree:function()
3751 {this._frames={};delete this._cachedResourcesProcessed;PageAgent.getResourceTree(this._processCachedResources.bind(this));},_processCachedResources:function(error,mainFramePayload)
3752 {if(error){console.error(JSON.stringify(error));return;}
3753 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources);WebInspector.inspectedPageURL=mainFramePayload.frame.url;this._addFramesRecursively(null,mainFramePayload);this._dispatchInspectedURLChanged();this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded);this._cachedResourcesProcessed=true;},cachedResourcesLoaded:function()
3754 {return this._cachedResourcesProcessed;},_dispatchInspectedURLChanged:function()
3755 {InspectorFrontendHost.inspectedURLChanged(WebInspector.inspectedPageURL);this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,WebInspector.inspectedPageURL);},_addFrame:function(frame,aboutToNavigate)
3756 {this._frames[frame.id]=frame;if(frame.isMainFrame())
3757 this.mainFrame=frame;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameAdded,frame);if(!aboutToNavigate)
3758 this._addSecurityOrigin(frame.securityOrigin);if(frame.isMainFrame())
3759 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated,frame);},_addSecurityOrigin:function(securityOrigin)
3760 {if(!this._securityOriginFrameCount[securityOrigin]){this._securityOriginFrameCount[securityOrigin]=1;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,securityOrigin);return;}
3761 this._securityOriginFrameCount[securityOrigin]+=1;},_removeSecurityOrigin:function(securityOrigin)
3762 {if(typeof securityOrigin==="undefined")
3763 return;if(this._securityOriginFrameCount[securityOrigin]===1){delete this._securityOriginFrameCount[securityOrigin];this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,securityOrigin);return;}
3764 this._securityOriginFrameCount[securityOrigin]-=1;},securityOrigins:function()
3765 {return Object.keys(this._securityOriginFrameCount);},_handleMainFrameDetached:function(mainFrame)
3766 {function removeOriginForFrame(frame)
3767 {for(var i=0;i<frame.childFrames.length;++i)
3768 removeOriginForFrame.call(this,frame.childFrames[i]);if(!frame.isMainFrame())
3769 this._removeSecurityOrigin(frame.securityOrigin);}
3770 removeOriginForFrame.call(this,WebInspector.resourceTreeModel.mainFrame);},_frameAttached:function(frameId,parentFrameId)
3771 {if(!this._cachedResourcesProcessed)
3772 return null;if(this._frames[frameId])
3773 return null;var parentFrame=parentFrameId?this._frames[parentFrameId]:null;var frame=new WebInspector.ResourceTreeFrame(this,parentFrame,frameId);if(frame.isMainFrame()&&this.mainFrame){this._handleMainFrameDetached(this.mainFrame);this._frameDetached(this.mainFrame.id);}
3774 this._addFrame(frame,true);return frame;},_frameNavigated:function(framePayload)
3775 {if(!this._cachedResourcesProcessed)
3776 return;var frame=this._frames[framePayload.id];if(!frame){console.assert(!framePayload.parentId,"Main frame shouldn't have parent frame id.");frame=this._frameAttached(framePayload.id,framePayload.parentId||"");console.assert(frame);}
3777 this._removeSecurityOrigin(frame.securityOrigin);frame._navigate(framePayload);var addedOrigin=frame.securityOrigin;if(frame.isMainFrame())
3778 WebInspector.inspectedPageURL=frame.url;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,frame);if(frame.isMainFrame()){this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,frame);this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated,frame);}
3779 if(addedOrigin)
3780 this._addSecurityOrigin(addedOrigin);var resources=frame.resources();for(var i=0;i<resources.length;++i)
3781 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resources[i]);if(frame.isMainFrame())
3782 this._dispatchInspectedURLChanged();},_frameDetached:function(frameId)
3783 {if(!this._cachedResourcesProcessed)
3784 return;var frame=this._frames[frameId];if(!frame)
3785 return;this._removeSecurityOrigin(frame.securityOrigin);if(frame.parentFrame)
3786 frame.parentFrame._removeChildFrame(frame);else
3787 frame._remove();},_onRequestFinished:function(event)
3788 {if(!this._cachedResourcesProcessed)
3789 return;var request=(event.data);if(request.failed||request.type===WebInspector.resourceTypes.XHR)
3790 return;var frame=this._frames[request.frameId];if(frame){var resource=frame._addRequest(request);this._addPendingConsoleMessagesToResource(resource);}},_onRequestUpdateDropped:function(event)
3791 {if(!this._cachedResourcesProcessed)
3792 return;var frameId=event.data.frameId;var frame=this._frames[frameId];if(!frame)
3793 return;var url=event.data.url;if(frame._resourcesMap[url])
3794 return;var resource=new WebInspector.Resource(null,url,frame.url,frameId,event.data.loaderId,WebInspector.resourceTypes[event.data.resourceType],event.data.mimeType);frame.addResource(resource);},frameForId:function(frameId)
3795 {return this._frames[frameId];},forAllResources:function(callback)
3796 {if(this.mainFrame)
3797 return this.mainFrame._callForFrameResources(callback);return false;},frames:function()
3798 {return Object.values(this._frames);},_consoleMessageAdded:function(event)
3799 {var msg=(event.data);var resource=msg.url?this.resourceForURL(msg.url):null;if(resource)
3800 this._addConsoleMessageToResource(msg,resource);else
3801 this._addPendingConsoleMessage(msg);},_addPendingConsoleMessage:function(msg)
3802 {if(!msg.url)
3803 return;if(!this._pendingConsoleMessages[msg.url])
3804 this._pendingConsoleMessages[msg.url]=[];this._pendingConsoleMessages[msg.url].push(msg);},_addPendingConsoleMessagesToResource:function(resource)
3805 {var messages=this._pendingConsoleMessages[resource.url];if(messages){for(var i=0;i<messages.length;i++)
3806 this._addConsoleMessageToResource(messages[i],resource);delete this._pendingConsoleMessages[resource.url];}},_addConsoleMessageToResource:function(msg,resource)
3807 {switch(msg.level){case WebInspector.ConsoleMessage.MessageLevel.Warning:resource.warnings+=msg.repeatDelta;break;case WebInspector.ConsoleMessage.MessageLevel.Error:resource.errors+=msg.repeatDelta;break;}
3808 resource.addMessage(msg);},_consoleCleared:function()
3809 {function callback(resource)
3810 {resource.clearErrorsAndWarnings();}
3811 this._pendingConsoleMessages={};this.forAllResources(callback);},resourceForURL:function(url)
3812 {return this.mainFrame?this.mainFrame.resourceForURL(url):null;},_addFramesRecursively:function(parentFrame,frameTreePayload)
3813 {var framePayload=frameTreePayload.frame;var frame=new WebInspector.ResourceTreeFrame(this,parentFrame,framePayload.id,framePayload);this._addFrame(frame);var frameResource=this._createResourceFromFramePayload(framePayload,framePayload.url,WebInspector.resourceTypes.Document,framePayload.mimeType);if(frame.isMainFrame())
3814 WebInspector.inspectedPageURL=frameResource.url;frame.addResource(frameResource);for(var i=0;frameTreePayload.childFrames&&i<frameTreePayload.childFrames.length;++i)
3815 this._addFramesRecursively(frame,frameTreePayload.childFrames[i]);for(var i=0;i<frameTreePayload.resources.length;++i){var subresource=frameTreePayload.resources[i];var resource=this._createResourceFromFramePayload(framePayload,subresource.url,WebInspector.resourceTypes[subresource.type],subresource.mimeType);frame.addResource(resource);}},_createResourceFromFramePayload:function(frame,url,type,mimeType)
3816 {return new WebInspector.Resource(null,url,frame.url,frame.id,frame.loaderId,type,mimeType);},reloadPage:function(ignoreCache,scriptToEvaluateOnLoad,scriptPreprocessor)
3817 {this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillReloadPage);PageAgent.reload(ignoreCache,scriptToEvaluateOnLoad,scriptPreprocessor);},__proto__:WebInspector.Object.prototype}
3818 WebInspector.ResourceTreeFrame=function(model,parentFrame,frameId,payload)
3819 {this._model=model;this._parentFrame=parentFrame;this._id=frameId;this._url="";if(payload){this._loaderId=payload.loaderId;this._name=payload.name;this._url=payload.url;this._securityOrigin=payload.securityOrigin;this._mimeType=payload.mimeType;}
3820 this._childFrames=[];this._resourcesMap={};if(this._parentFrame)
3821 this._parentFrame._childFrames.push(this);}
3822 WebInspector.ResourceTreeFrame.prototype={get id()
3823 {return this._id;},get name()
3824 {return this._name||"";},get url()
3825 {return this._url;},get securityOrigin()
3826 {return this._securityOrigin;},get loaderId()
3827 {return this._loaderId;},get parentFrame()
3828 {return this._parentFrame;},get childFrames()
3829 {return this._childFrames;},isMainFrame:function()
3830 {return!this._parentFrame;},_navigate:function(framePayload)
3831 {this._loaderId=framePayload.loaderId;this._name=framePayload.name;this._url=framePayload.url;this._securityOrigin=framePayload.securityOrigin;this._mimeType=framePayload.mimeType;var mainResource=this._resourcesMap[this._url];this._resourcesMap={};this._removeChildFrames();if(mainResource&&mainResource.loaderId===this._loaderId)
3832 this.addResource(mainResource);},get mainResource()
3833 {return this._resourcesMap[this._url];},_removeChildFrame:function(frame)
3834 {this._childFrames.remove(frame);frame._remove();},_removeChildFrames:function()
3835 {var frames=this._childFrames;this._childFrames=[];for(var i=0;i<frames.length;++i)
3836 frames[i]._remove();},_remove:function()
3837 {this._removeChildFrames();delete this._model._frames[this.id];this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this);},addResource:function(resource)
3838 {if(this._resourcesMap[resource.url]===resource){return;}
3839 this._resourcesMap[resource.url]=resource;this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resource);},_addRequest:function(request)
3840 {var resource=this._resourcesMap[request.url];if(resource&&resource.request===request){return resource;}
3841 resource=new WebInspector.Resource(request,request.url,request.documentURL,request.frameId,request.loaderId,request.type,request.mimeType);this._resourcesMap[resource.url]=resource;this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resource);return resource;},resources:function()
3842 {var result=[];for(var url in this._resourcesMap)
3843 result.push(this._resourcesMap[url]);return result;},resourceForURL:function(url)
3844 {var result;function filter(resource)
3845 {if(resource.url===url){result=resource;return true;}}
3846 this._callForFrameResources(filter);return result;},_callForFrameResources:function(callback)
3847 {for(var url in this._resourcesMap){if(callback(this._resourcesMap[url]))
3848 return true;}
3849 for(var i=0;i<this._childFrames.length;++i){if(this._childFrames[i]._callForFrameResources(callback))
3850 return true;}
3851 return false;}}
3852 WebInspector.PageDispatcher=function(resourceTreeModel)
3853 {this._resourceTreeModel=resourceTreeModel;}
3854 WebInspector.PageDispatcher.prototype={domContentEventFired:function(time)
3855 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded,time);},loadEventFired:function(time)
3856 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.Load,time);},frameAttached:function(frameId,parentFrameId)
3857 {this._resourceTreeModel._frameAttached(frameId,parentFrameId);},frameNavigated:function(frame)
3858 {this._resourceTreeModel._frameNavigated(frame);},frameDetached:function(frameId)
3859 {this._resourceTreeModel._frameDetached(frameId);},frameStartedLoading:function(frameId)
3860 {},frameStoppedLoading:function(frameId)
3861 {},frameScheduledNavigation:function(frameId,delay)
3862 {},frameClearedScheduledNavigation:function(frameId)
3863 {},frameResized:function()
3864 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameResized,null);},javascriptDialogOpening:function(message)
3865 {},javascriptDialogClosed:function()
3866 {},scriptsEnabled:function(isEnabled)
3867 {WebInspector.settings.javaScriptDisabled.set(!isEnabled);},screencastFrame:function(data,metadata)
3868 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame,{data:data,metadata:metadata});},screencastVisibilityChanged:function(visible)
3869 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ScreencastVisibilityChanged,{visible:visible});}}
3870 WebInspector.resourceTreeModel;WebInspector.ParsedURL=function(url)
3871 {this.isValid=false;this.url=url;this.scheme="";this.host="";this.port="";this.path="";this.queryParams="";this.fragment="";this.folderPathComponents="";this.lastPathComponent="";var match=url.match(/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);if(match){this.isValid=true;this.scheme=match[1].toLowerCase();this.host=match[2];this.port=match[3];this.path=match[4]||"/";this.fragment=match[5];}else{if(this.url.startsWith("data:")){this.scheme="data";return;}
3872 if(this.url==="about:blank"){this.scheme="about";return;}
3873 this.path=this.url;}
3874 var path=this.path;var indexOfQuery=path.indexOf("?");if(indexOfQuery!==-1){this.queryParams=path.substring(indexOfQuery+1)
3875 path=path.substring(0,indexOfQuery);}
3876 var lastSlashIndex=path.lastIndexOf("/");if(lastSlashIndex!==-1){this.folderPathComponents=path.substring(0,lastSlashIndex);this.lastPathComponent=path.substring(lastSlashIndex+1);}else
3877 this.lastPathComponent=path;}
3878 WebInspector.ParsedURL.splitURL=function(url)
3879 {var parsedURL=new WebInspector.ParsedURL(url);var origin;var folderPath;var name;if(parsedURL.isValid){origin=parsedURL.scheme+"://"+parsedURL.host;if(parsedURL.port)
3880 origin+=":"+parsedURL.port;folderPath=parsedURL.folderPathComponents;name=parsedURL.lastPathComponent;if(parsedURL.queryParams)
3881 name+="?"+parsedURL.queryParams;}else{origin="";folderPath="";name=url;}
3882 var result=[origin];var splittedPath=folderPath.split("/");for(var i=1;i<splittedPath.length;++i)
3883 result.push(splittedPath[i]);result.push(name);return result;}
3884 WebInspector.ParsedURL.normalizePath=function(path)
3885 {if(path.indexOf("..")===-1&&path.indexOf('.')===-1)
3886 return path;var normalizedSegments=[];var segments=path.split("/");for(var i=0;i<segments.length;i++){var segment=segments[i];if(segment===".")
3887 continue;else if(segment==="..")
3888 normalizedSegments.pop();else if(segment)
3889 normalizedSegments.push(segment);}
3890 var normalizedPath=normalizedSegments.join("/");if(normalizedPath[normalizedPath.length-1]==="/")
3891 return normalizedPath;if(path[0]==="/"&&normalizedPath)
3892 normalizedPath="/"+normalizedPath;if((path[path.length-1]==="/")||(segments[segments.length-1]===".")||(segments[segments.length-1]===".."))
3893 normalizedPath=normalizedPath+"/";return normalizedPath;}
3894 WebInspector.ParsedURL.completeURL=function(baseURL,href)
3895 {if(href){var trimmedHref=href.trim();if(trimmedHref.startsWith("data:")||trimmedHref.startsWith("blob:")||trimmedHref.startsWith("javascript:"))
3896 return href;var parsedHref=trimmedHref.asParsedURL();if(parsedHref&&parsedHref.scheme)
3897 return trimmedHref;}else{return baseURL;}
3898 var parsedURL=baseURL.asParsedURL();if(parsedURL){if(parsedURL.isDataURL())
3899 return href;var path=href;var query=path.indexOf("?");var postfix="";if(query!==-1){postfix=path.substring(query);path=path.substring(0,query);}else{var fragment=path.indexOf("#");if(fragment!==-1){postfix=path.substring(fragment);path=path.substring(0,fragment);}}
3900 if(!path){var basePath=parsedURL.path;if(postfix.charAt(0)==="?"){var baseQuery=parsedURL.path.indexOf("?");if(baseQuery!==-1)
3901 basePath=basePath.substring(0,baseQuery);}
3902 return parsedURL.scheme+"://"+parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"")+basePath+postfix;}else if(path.charAt(0)!=="/"){var prefix=parsedURL.path;var prefixQuery=prefix.indexOf("?");if(prefixQuery!==-1)
3903 prefix=prefix.substring(0,prefixQuery);prefix=prefix.substring(0,prefix.lastIndexOf("/"))+"/";path=prefix+path;}else if(path.length>1&&path.charAt(1)==="/"){return parsedURL.scheme+":"+path+postfix;}
3904 return parsedURL.scheme+"://"+parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"")+WebInspector.ParsedURL.normalizePath(path)+postfix;}
3905 return null;}
3906 WebInspector.ParsedURL.prototype={get displayName()
3907 {if(this._displayName)
3908 return this._displayName;if(this.isDataURL())
3909 return this.dataURLDisplayName();if(this.isAboutBlank())
3910 return this.url;this._displayName=this.lastPathComponent;if(!this._displayName&&this.host)
3911 this._displayName=this.host+"/";if(!this._displayName&&this.url)
3912 this._displayName=this.url.trimURL(WebInspector.inspectedPageDomain?WebInspector.inspectedPageDomain:"");if(this._displayName==="/")
3913 this._displayName=this.url;return this._displayName;},dataURLDisplayName:function()
3914 {if(this._dataURLDisplayName)
3915 return this._dataURLDisplayName;if(!this.isDataURL())
3916 return"";this._dataURLDisplayName=this.url.trimEnd(20);return this._dataURLDisplayName;},isAboutBlank:function()
3917 {return this.url==="about:blank";},isDataURL:function()
3918 {return this.scheme==="data";}}
3919 String.prototype.asParsedURL=function()
3920 {var parsedURL=new WebInspector.ParsedURL(this.toString());if(parsedURL.isValid)
3921 return parsedURL;return null;}
3922 WebInspector.resourceForURL=function(url)
3923 {return WebInspector.resourceTreeModel.resourceForURL(url);}
3924 WebInspector.forAllResources=function(callback)
3925 {WebInspector.resourceTreeModel.forAllResources(callback);}
3926 WebInspector.displayNameForURL=function(url)
3927 {if(!url)
3928 return"";var resource=WebInspector.resourceForURL(url);if(resource)
3929 return resource.displayName;var uiSourceCode=WebInspector.workspace.uiSourceCodeForURL(url);if(uiSourceCode)
3930 return uiSourceCode.displayName();if(!WebInspector.inspectedPageURL)
3931 return url.trimURL("");var parsedURL=WebInspector.inspectedPageURL.asParsedURL();var lastPathComponent=parsedURL?parsedURL.lastPathComponent:parsedURL;var index=WebInspector.inspectedPageURL.indexOf(lastPathComponent);if(index!==-1&&index+lastPathComponent.length===WebInspector.inspectedPageURL.length){var baseURL=WebInspector.inspectedPageURL.substring(0,index);if(url.startsWith(baseURL))
3932 return url.substring(index);}
3933 if(!parsedURL)
3934 return url;var displayName=url.trimURL(parsedURL.host);return displayName==="/"?parsedURL.host+"/":displayName;}
3935 WebInspector.linkifyStringAsFragmentWithCustomLinkifier=function(string,linkifier)
3936 {var container=document.createDocumentFragment();var linkStringRegEx=/(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/;var lineColumnRegEx=/:(\d+)(:(\d+))?$/;while(string){var linkString=linkStringRegEx.exec(string);if(!linkString)
3937 break;linkString=linkString[0];var linkIndex=string.indexOf(linkString);var nonLink=string.substring(0,linkIndex);container.appendChild(document.createTextNode(nonLink));var title=linkString;var realURL=(linkString.startsWith("www.")?"http://"+linkString:linkString);var lineColumnMatch=lineColumnRegEx.exec(realURL);var lineNumber;var columnNumber;if(lineColumnMatch){realURL=realURL.substring(0,realURL.length-lineColumnMatch[0].length);lineNumber=parseInt(lineColumnMatch[1],10);lineNumber=isNaN(lineNumber)?undefined:lineNumber-1;if(typeof(lineColumnMatch[3])==="string"){columnNumber=parseInt(lineColumnMatch[3],10);columnNumber=isNaN(columnNumber)?undefined:columnNumber-1;}}
3938 var linkNode=linkifier(title,realURL,lineNumber,columnNumber);container.appendChild(linkNode);string=string.substring(linkIndex+linkString.length,string.length);}
3939 if(string)
3940 container.appendChild(document.createTextNode(string));return container;}
3941 WebInspector.linkifyStringAsFragment=function(string)
3942 {function linkifier(title,url,lineNumber,columnNumber)
3943 {var isExternal=!WebInspector.resourceForURL(url)&&!WebInspector.workspace.uiSourceCodeForURL(url);var urlNode=WebInspector.linkifyURLAsNode(url,title,undefined,isExternal);if(typeof lineNumber!=="undefined"){urlNode.lineNumber=lineNumber;urlNode.preferredPanel="sources";if(typeof columnNumber!=="undefined")
3944 urlNode.columnNumber=columnNumber;}
3945 return urlNode;}
3946 return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string,linkifier);}
3947 WebInspector.linkifyURLAsNode=function(url,linkText,classes,isExternal,tooltipText)
3948 {if(!linkText)
3949 linkText=url;classes=(classes?classes+" ":"");classes+=isExternal?"webkit-html-external-link":"webkit-html-resource-link";var a=document.createElement("a");a.href=sanitizeHref(url);a.className=classes;if(typeof tooltipText==="undefined")
3950 a.title=url;else if(typeof tooltipText!=="string"||tooltipText.length)
3951 a.title=tooltipText;a.textContent=linkText.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayedURLs);if(isExternal)
3952 a.setAttribute("target","_blank");return a;}
3953 WebInspector.formatLinkText=function(url,lineNumber)
3954 {var text=url?WebInspector.displayNameForURL(url):WebInspector.UIString("(program)");if(typeof lineNumber==="number")
3955 text+=":"+(lineNumber+1);return text;}
3956 WebInspector.linkifyResourceAsNode=function(url,lineNumber,classes,tooltipText)
3957 {var linkText=WebInspector.formatLinkText(url,lineNumber);var anchor=WebInspector.linkifyURLAsNode(url,linkText,classes,false,tooltipText);anchor.lineNumber=lineNumber;return anchor;}
3958 WebInspector.linkifyRequestAsNode=function(request)
3959 {var anchor=WebInspector.linkifyURLAsNode(request.url);anchor.preferredPanel="network";anchor.requestId=request.requestId;return anchor;}
3960 WebInspector.contentAsDataURL=function(content,mimeType,contentEncoded)
3961 {const maxDataUrlSize=1024*1024;if(content===null||content.length>maxDataUrlSize)
3962 return null;return"data:"+mimeType+(contentEncoded?";base64,":",")+content;}
3963 WebInspector.ResourceType=function(name,title,categoryTitle,color,isTextType)
3964 {this._name=name;this._title=title;this._categoryTitle=categoryTitle;this._color=color;this._isTextType=isTextType;}
3965 WebInspector.ResourceType.prototype={name:function()
3966 {return this._name;},title:function()
3967 {return this._title;},categoryTitle:function()
3968 {return this._categoryTitle;},color:function()
3969 {return this._color;},isTextType:function()
3970 {return this._isTextType;},toString:function()
3971 {return this._name;},canonicalMimeType:function()
3972 {if(this===WebInspector.resourceTypes.Document)
3973 return"text/html";if(this===WebInspector.resourceTypes.Script)
3974 return"text/javascript";if(this===WebInspector.resourceTypes.Stylesheet)
3975 return"text/css";return"";}}
3976 WebInspector.resourceTypes={Document:new WebInspector.ResourceType("document","Document","Documents","rgb(47,102,236)",true),Stylesheet:new WebInspector.ResourceType("stylesheet","Stylesheet","Stylesheets","rgb(157,231,119)",true),Image:new WebInspector.ResourceType("image","Image","Images","rgb(164,60,255)",false),Script:new WebInspector.ResourceType("script","Script","Scripts","rgb(255,121,0)",true),XHR:new WebInspector.ResourceType("xhr","XHR","XHR","rgb(231,231,10)",true),Font:new WebInspector.ResourceType("font","Font","Fonts","rgb(255,82,62)",false),WebSocket:new WebInspector.ResourceType("websocket","WebSocket","WebSockets","rgb(186,186,186)",false),Other:new WebInspector.ResourceType("other","Other","Other","rgb(186,186,186)",false)}
3977 WebInspector.ResourceType.mimeTypesForExtensions={"js":"text/javascript","css":"text/css","html":"text/html","htm":"text/html","xml":"application/xml","xsl":"application/xml","asp":"application/x-aspx","aspx":"application/x-aspx","jsp":"application/x-jsp","c":"text/x-c++src","cc":"text/x-c++src","cpp":"text/x-c++src","h":"text/x-c++src","m":"text/x-c++src","mm":"text/x-c++src","coffee":"text/x-coffeescript","dart":"text/javascript","ts":"text/typescript","json":"application/json","gyp":"application/json","gypi":"application/json","cs":"text/x-csharp","java":"text/x-java","php":"text/x-php","phtml":"application/x-httpd-php","py":"text/x-python","sh":"text/x-sh","scss":"text/x-scss"}
3978 WebInspector.TimelineManager=function()
3979 {WebInspector.Object.call(this);this._dispatcher=new WebInspector.TimelineDispatcher(this);this._enablementCount=0;TimelineAgent.enable();}
3980 WebInspector.TimelineManager.EventTypes={TimelineStarted:"TimelineStarted",TimelineStopped:"TimelineStopped",TimelineEventRecorded:"TimelineEventRecorded"}
3981 WebInspector.TimelineManager.prototype={isStarted:function()
3982 {return this._dispatcher.isStarted();},start:function(maxCallStackDepth,includeCounters,includeGPUEvents,callback)
3983 {this._enablementCount++;if(this._enablementCount===1)
3984 TimelineAgent.start(maxCallStackDepth,false,includeCounters,includeGPUEvents,callback);else if(callback)
3985 callback(null);},stop:function(callback)
3986 {this._enablementCount--;if(this._enablementCount<0){console.error("WebInspector.TimelineManager start/stop calls are unbalanced "+new Error().stack);return;}
3987 if(!this._enablementCount)
3988 TimelineAgent.stop(callback);else if(callback)
3989 callback(null);},__proto__:WebInspector.Object.prototype}
3990 WebInspector.TimelineDispatcher=function(manager)
3991 {this._manager=manager;InspectorBackend.registerTimelineDispatcher(this);}
3992 WebInspector.TimelineDispatcher.prototype={eventRecorded:function(record)
3993 {this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,record);},isStarted:function()
3994 {return!!this._started;},started:function(consoleTimeline)
3995 {if(consoleTimeline){WebInspector.panel("timeline");}
3996 this._started=true;this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStarted,consoleTimeline);},stopped:function(consoleTimeline)
3997 {this._started=false;this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStopped,consoleTimeline);}}
3998 WebInspector.timelineManager;WebInspector.OverridesSupport=function()
3999 {WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated.bind(this),this);this._deviceMetricsOverrideEnabled=false;this._emulateViewportEnabled=false;this._userAgent="";WebInspector.settings.overrideUserAgent.addChangeListener(this._userAgentChanged,this);WebInspector.settings.userAgent.addChangeListener(this._userAgentChanged,this);WebInspector.settings.overrideDeviceMetrics.addChangeListener(this._deviceMetricsChanged,this);WebInspector.settings.deviceMetrics.addChangeListener(this._deviceMetricsChanged,this);WebInspector.settings.emulateViewport.addChangeListener(this._deviceMetricsChanged,this);WebInspector.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChanged,this);WebInspector.settings.overrideGeolocation.addChangeListener(this._geolocationPositionChanged,this);WebInspector.settings.geolocationOverride.addChangeListener(this._geolocationPositionChanged,this);WebInspector.settings.overrideDeviceOrientation.addChangeListener(this._deviceOrientationChanged,this);WebInspector.settings.deviceOrientationOverride.addChangeListener(this._deviceOrientationChanged,this);WebInspector.settings.emulateTouchEvents.addChangeListener(this._emulateTouchEventsChanged,this);WebInspector.settings.overrideCSSMedia.addChangeListener(this._cssMediaChanged,this);WebInspector.settings.emulatedCSSMedia.addChangeListener(this._cssMediaChanged,this);}
4000 WebInspector.OverridesSupport.Events={OverridesWarningUpdated:"OverridesWarningUpdated",}
4001 WebInspector.OverridesSupport.DeviceMetrics=function(width,height,deviceScaleFactor,textAutosizing)
4002 {this.width=width;this.height=height;this.deviceScaleFactor=deviceScaleFactor;this.textAutosizing=textAutosizing;}
4003 WebInspector.OverridesSupport.DeviceMetrics.parseSetting=function(value)
4004 {var width=0;var height=0;var deviceScaleFactor=1;var textAutosizing=true;if(value){var splitMetrics=value.split("x");if(splitMetrics.length>=3){width=parseInt(splitMetrics[0],10);height=parseInt(splitMetrics[1],10);deviceScaleFactor=parseFloat(splitMetrics[2]);if(splitMetrics.length==4)
4005 textAutosizing=splitMetrics[3]==1;}}
4006 return new WebInspector.OverridesSupport.DeviceMetrics(width,height,deviceScaleFactor,textAutosizing);}
4007 WebInspector.OverridesSupport.DeviceMetrics.parseUserInput=function(widthString,heightString,deviceScaleFactorString,textAutosizing)
4008 {function isUserInputValid(value,isInteger)
4009 {if(!value)
4010 return true;return isInteger?/^[0]*[1-9][\d]*$/.test(value):/^[0]*([1-9][\d]*(\.\d+)?|\.\d+)$/.test(value);}
4011 if(!widthString^!heightString)
4012 return null;var isWidthValid=isUserInputValid(widthString,true);var isHeightValid=isUserInputValid(heightString,true);var isDeviceScaleFactorValid=isUserInputValid(deviceScaleFactorString,false);if(!isWidthValid&&!isHeightValid&&!isDeviceScaleFactorValid)
4013 return null;var width=isWidthValid?parseInt(widthString||"0",10):-1;var height=isHeightValid?parseInt(heightString||"0",10):-1;var deviceScaleFactor=isDeviceScaleFactorValid?parseFloat(deviceScaleFactorString):-1;return new WebInspector.OverridesSupport.DeviceMetrics(width,height,deviceScaleFactor,textAutosizing);}
4014 WebInspector.OverridesSupport.DeviceMetrics.prototype={isValid:function()
4015 {return this.isWidthValid()&&this.isHeightValid()&&this.isDeviceScaleFactorValid();},isWidthValid:function()
4016 {return this.width>=0;},isHeightValid:function()
4017 {return this.height>=0;},isDeviceScaleFactorValid:function()
4018 {return this.deviceScaleFactor>0;},toSetting:function()
4019 {if(!this.isValid())
4020 return"";return this.width&&this.height?this.width+"x"+this.height+"x"+this.deviceScaleFactor+"x"+(this.textAutosizing?"1":"0"):"";},widthToInput:function()
4021 {return this.isWidthValid()&&this.width?String(this.width):"";},heightToInput:function()
4022 {return this.isHeightValid()&&this.height?String(this.height):"";},deviceScaleFactorToInput:function()
4023 {return this.isDeviceScaleFactorValid()&&this.deviceScaleFactor?String(this.deviceScaleFactor):"";},fontScaleFactor:function()
4024 {if(this.isValid()){var minWidth=Math.min(this.width,this.height)/this.deviceScaleFactor;var kMinFSM=1.05;var kWidthForMinFSM=320;var kMaxFSM=1.3;var kWidthForMaxFSM=800;if(minWidth<=kWidthForMinFSM)
4025 return kMinFSM;if(minWidth>=kWidthForMaxFSM)
4026 return kMaxFSM;var ratio=(minWidth-kWidthForMinFSM)/(kWidthForMaxFSM-kWidthForMinFSM);return ratio*(kMaxFSM-kMinFSM)+kMinFSM;}
4027 return 1;}}
4028 WebInspector.OverridesSupport.GeolocationPosition=function(latitude,longitude,error)
4029 {this.latitude=latitude;this.longitude=longitude;this.error=error;}
4030 WebInspector.OverridesSupport.GeolocationPosition.prototype={toSetting:function()
4031 {return(typeof this.latitude==="number"&&typeof this.longitude==="number"&&typeof this.error==="string")?this.latitude+"@"+this.longitude+":"+this.error:"";}}
4032 WebInspector.OverridesSupport.GeolocationPosition.parseSetting=function(value)
4033 {if(value){var splitError=value.split(":");if(splitError.length===2){var splitPosition=splitError[0].split("@")
4034 if(splitPosition.length===2)
4035 return new WebInspector.OverridesSupport.GeolocationPosition(parseFloat(splitPosition[0]),parseFloat(splitPosition[1]),splitError[1]);}}
4036 return new WebInspector.OverridesSupport.GeolocationPosition(0,0,"");}
4037 WebInspector.OverridesSupport.GeolocationPosition.parseUserInput=function(latitudeString,longitudeString,errorStatus)
4038 {function isUserInputValid(value)
4039 {if(!value)
4040 return true;return/^[-]?[0-9]*[.]?[0-9]*$/.test(value);}
4041 if(!latitudeString^!latitudeString)
4042 return null;var isLatitudeValid=isUserInputValid(latitudeString);var isLongitudeValid=isUserInputValid(longitudeString);if(!isLatitudeValid&&!isLongitudeValid)
4043 return null;var latitude=isLatitudeValid?parseFloat(latitudeString):-1;var longitude=isLongitudeValid?parseFloat(longitudeString):-1;return new WebInspector.OverridesSupport.GeolocationPosition(latitude,longitude,errorStatus?"PositionUnavailable":"");}
4044 WebInspector.OverridesSupport.GeolocationPosition.clearGeolocationOverride=function()
4045 {PageAgent.clearGeolocationOverride();}
4046 WebInspector.OverridesSupport.DeviceOrientation=function(alpha,beta,gamma)
4047 {this.alpha=alpha;this.beta=beta;this.gamma=gamma;}
4048 WebInspector.OverridesSupport.DeviceOrientation.prototype={toSetting:function()
4049 {return JSON.stringify(this);}}
4050 WebInspector.OverridesSupport.DeviceOrientation.parseSetting=function(value)
4051 {if(value){var jsonObject=JSON.parse(value);return new WebInspector.OverridesSupport.DeviceOrientation(jsonObject.alpha,jsonObject.beta,jsonObject.gamma);}
4052 return new WebInspector.OverridesSupport.DeviceOrientation(0,0,0);}
4053 WebInspector.OverridesSupport.DeviceOrientation.parseUserInput=function(alphaString,betaString,gammaString)
4054 {function isUserInputValid(value)
4055 {if(!value)
4056 return true;return/^[-]?[0-9]*[.]?[0-9]*$/.test(value);}
4057 if(!alphaString^!betaString^!gammaString)
4058 return null;var isAlphaValid=isUserInputValid(alphaString);var isBetaValid=isUserInputValid(betaString);var isGammaValid=isUserInputValid(gammaString);if(!isAlphaValid&&!isBetaValid&&!isGammaValid)
4059 return null;var alpha=isAlphaValid?parseFloat(alphaString):-1;var beta=isBetaValid?parseFloat(betaString):-1;var gamma=isGammaValid?parseFloat(gammaString):-1;return new WebInspector.OverridesSupport.DeviceOrientation(alpha,beta,gamma);}
4060 WebInspector.OverridesSupport.DeviceOrientation.clearDeviceOrientationOverride=function()
4061 {PageAgent.clearDeviceOrientationOverride();}
4062 WebInspector.OverridesSupport.prototype={emulateDevice:function(deviceMetrics,userAgent)
4063 {this._deviceMetricsChangedListenerMuted=true;this._userAgentChangedListenerMuted=true;WebInspector.settings.deviceMetrics.set(deviceMetrics);WebInspector.settings.userAgent.set(userAgent);WebInspector.settings.overrideDeviceMetrics.set(true);WebInspector.settings.overrideUserAgent.set(true);WebInspector.settings.emulateTouchEvents.set(true);WebInspector.settings.emulateViewport.set(true);delete this._deviceMetricsChangedListenerMuted;delete this._userAgentChangedListenerMuted;this._deviceMetricsChanged();this._userAgentChanged();},reset:function()
4064 {this._deviceMetricsChangedListenerMuted=true;this._userAgentChangedListenerMuted=true;WebInspector.settings.overrideDeviceMetrics.set(false);WebInspector.settings.overrideUserAgent.set(false);WebInspector.settings.emulateTouchEvents.set(false);WebInspector.settings.overrideDeviceOrientation.set(false);WebInspector.settings.overrideGeolocation.set(false);WebInspector.settings.overrideCSSMedia.set(false);WebInspector.settings.emulateViewport.set(false);WebInspector.settings.deviceMetrics.set("");delete this._deviceMetricsChangedListenerMuted;delete this._userAgentChangedListenerMuted;this._deviceMetricsChanged();this._userAgentChanged();},applyInitialOverrides:function()
4065 {this._deviceMetricsChangedListenerMuted=true;this._userAgentChangedListenerMuted=true;this._userAgentChanged();this._deviceMetricsChanged();this._deviceOrientationChanged();this._geolocationPositionChanged();this._emulateTouchEventsChanged();this._cssMediaChanged();delete this._deviceMetricsChangedListenerMuted;delete this._userAgentChangedListenerMuted;this._deviceMetricsChanged();this._userAgentChanged();},_userAgentChanged:function()
4066 {if(WebInspector.isInspectingDevice()||this._userAgentChangedListenerMuted)
4067 return;var userAgent=WebInspector.settings.overrideUserAgent.get()?WebInspector.settings.userAgent.get():"";NetworkAgent.setUserAgentOverride(userAgent);this._updateUserAgentWarningMessage(this._userAgent!==userAgent?WebInspector.UIString("You might need to reload the page for proper user agent spoofing and viewport rendering."):"");this._userAgent=userAgent;},_deviceMetricsChanged:function()
4068 {if(this._deviceMetricsChangedListenerMuted)
4069 return;var metrics=WebInspector.OverridesSupport.DeviceMetrics.parseSetting(WebInspector.settings.overrideDeviceMetrics.get()?WebInspector.settings.deviceMetrics.get():"");if(!metrics.isValid())
4070 return;var dipWidth=Math.round(metrics.width/metrics.deviceScaleFactor);var dipHeight=Math.round(metrics.height/metrics.deviceScaleFactor);if(dipWidth&&dipHeight&&WebInspector.isInspectingDevice()){this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Screen emulation on the device is not available."));return;}
4071 PageAgent.setDeviceMetricsOverride(dipWidth,dipHeight,metrics.deviceScaleFactor,WebInspector.settings.emulateViewport.get(),WebInspector.settings.deviceFitWindow.get(),metrics.textAutosizing,metrics.fontScaleFactor(),apiCallback.bind(this));function apiCallback(error)
4072 {if(error){this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Screen emulation is not available on this page."));return;}
4073 var metricsOverrideEnabled=!!(dipWidth&&dipHeight);var viewportEnabled=WebInspector.settings.emulateViewport.get();this._updateDeviceMetricsWarningMessage(this._deviceMetricsOverrideEnabled!==metricsOverrideEnabled||(metricsOverrideEnabled&&this._emulateViewportEnabled!=viewportEnabled)?WebInspector.UIString("You might need to reload the page for proper user agent spoofing and viewport rendering."):"");this._deviceMetricsOverrideEnabled=metricsOverrideEnabled;this._emulateViewportEnabled=viewportEnabled;this._deviceMetricsOverrideAppliedForTest();}},_deviceMetricsOverrideAppliedForTest:function()
4074 {},_geolocationPositionChanged:function()
4075 {if(!WebInspector.settings.overrideGeolocation.get()){PageAgent.clearGeolocationOverride();return;}
4076 var geolocation=WebInspector.OverridesSupport.GeolocationPosition.parseSetting(WebInspector.settings.geolocationOverride.get());if(geolocation.error)
4077 PageAgent.setGeolocationOverride();else
4078 PageAgent.setGeolocationOverride(geolocation.latitude,geolocation.longitude,150);},_deviceOrientationChanged:function()
4079 {if(!WebInspector.settings.overrideDeviceOrientation.get()){PageAgent.clearDeviceOrientationOverride();return;}
4080 if(WebInspector.isInspectingDevice())
4081 return;var deviceOrientation=WebInspector.OverridesSupport.DeviceOrientation.parseSetting(WebInspector.settings.deviceOrientationOverride.get());PageAgent.setDeviceOrientationOverride(deviceOrientation.alpha,deviceOrientation.beta,deviceOrientation.gamma);},_emulateTouchEventsChanged:function()
4082 {if(WebInspector.isInspectingDevice()&&WebInspector.settings.emulateTouchEvents.get())
4083 return;WebInspector.domAgent.emulateTouchEventObjects(WebInspector.settings.emulateTouchEvents.get());},_cssMediaChanged:function()
4084 {PageAgent.setEmulatedMedia(WebInspector.settings.overrideCSSMedia.get()?WebInspector.settings.emulatedCSSMedia.get():"");WebInspector.cssModel.mediaQueryResultChanged();},hasActiveOverrides:function()
4085 {return WebInspector.settings.overrideUserAgent.get()||WebInspector.settings.overrideDeviceMetrics.get()||WebInspector.settings.overrideGeolocation.get()||WebInspector.settings.overrideDeviceOrientation.get()||WebInspector.settings.emulateTouchEvents.get()||WebInspector.settings.overrideCSSMedia.get();},_onMainFrameNavigated:function()
4086 {this._deviceMetricsChanged();this._updateUserAgentWarningMessage("");},_updateDeviceMetricsWarningMessage:function(warningMessage)
4087 {this._deviceMetricsWarningMessage=warningMessage;this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.OverridesWarningUpdated);},_updateUserAgentWarningMessage:function(warningMessage)
4088 {this._userAgentWarningMessage=warningMessage;this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.OverridesWarningUpdated);},warningMessage:function()
4089 {return this._deviceMetricsWarningMessage||this._userAgentWarningMessage||"";},__proto__:WebInspector.Object.prototype}
4090 WebInspector.overridesSupport;WebInspector.Database=function(model,id,domain,name,version)
4091 {this._model=model;this._id=id;this._domain=domain;this._name=name;this._version=version;}
4092 WebInspector.Database.prototype={get id()
4093 {return this._id;},get name()
4094 {return this._name;},set name(x)
4095 {this._name=x;},get version()
4096 {return this._version;},set version(x)
4097 {this._version=x;},get domain()
4098 {return this._domain;},set domain(x)
4099 {this._domain=x;},getTableNames:function(callback)
4100 {function sortingCallback(error,names)
4101 {if(!error)
4102 callback(names.sort());}
4103 DatabaseAgent.getDatabaseTableNames(this._id,sortingCallback);},executeSql:function(query,onSuccess,onError)
4104 {function callback(error,columnNames,values,errorObj)
4105 {if(error){onError(error);return;}
4106 if(errorObj){var message;if(errorObj.message)
4107 message=errorObj.message;else if(errorObj.code==2)
4108 message=WebInspector.UIString("Database no longer has expected version.");else
4109 message=WebInspector.UIString("An unexpected error %s occurred.",errorObj.code);onError(message);return;}
4110 onSuccess(columnNames,values);}
4111 DatabaseAgent.executeSQL(this._id,query,callback.bind(this));}}
4112 WebInspector.DatabaseModel=function()
4113 {this._databases=[];InspectorBackend.registerDatabaseDispatcher(new WebInspector.DatabaseDispatcher(this));DatabaseAgent.enable();}
4114 WebInspector.DatabaseModel.Events={DatabaseAdded:"DatabaseAdded"}
4115 WebInspector.DatabaseModel.prototype={databases:function()
4116 {var result=[];for(var databaseId in this._databases)
4117 result.push(this._databases[databaseId]);return result;},databaseForId:function(databaseId)
4118 {return this._databases[databaseId];},_addDatabase:function(database)
4119 {this._databases.push(database);this.dispatchEventToListeners(WebInspector.DatabaseModel.Events.DatabaseAdded,database);},__proto__:WebInspector.Object.prototype}
4120 WebInspector.DatabaseDispatcher=function(model)
4121 {this._model=model;}
4122 WebInspector.DatabaseDispatcher.prototype={addDatabase:function(payload)
4123 {this._model._addDatabase(new WebInspector.Database(this._model,payload.id,payload.domain,payload.name,payload.version));}}
4124 WebInspector.databaseModel;WebInspector.DOMStorage=function(securityOrigin,isLocalStorage)
4125 {this._securityOrigin=securityOrigin;this._isLocalStorage=isLocalStorage;}
4126 WebInspector.DOMStorage.storageId=function(securityOrigin,isLocalStorage)
4127 {return{securityOrigin:securityOrigin,isLocalStorage:isLocalStorage};}
4128 WebInspector.DOMStorage.Events={DOMStorageItemsCleared:"DOMStorageItemsCleared",DOMStorageItemRemoved:"DOMStorageItemRemoved",DOMStorageItemAdded:"DOMStorageItemAdded",DOMStorageItemUpdated:"DOMStorageItemUpdated"}
4129 WebInspector.DOMStorage.prototype={get id()
4130 {return WebInspector.DOMStorage.storageId(this._securityOrigin,this._isLocalStorage);},get securityOrigin()
4131 {return this._securityOrigin;},get isLocalStorage()
4132 {return this._isLocalStorage;},getItems:function(callback)
4133 {DOMStorageAgent.getDOMStorageItems(this.id,callback);},setItem:function(key,value)
4134 {DOMStorageAgent.setDOMStorageItem(this.id,key,value);},removeItem:function(key)
4135 {DOMStorageAgent.removeDOMStorageItem(this.id,key);},__proto__:WebInspector.Object.prototype}
4136 WebInspector.DOMStorageModel=function()
4137 {this._storages={};InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageDispatcher(this));DOMStorageAgent.enable();WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);}
4138 WebInspector.DOMStorageModel.Events={DOMStorageAdded:"DOMStorageAdded",DOMStorageRemoved:"DOMStorageRemoved"}
4139 WebInspector.DOMStorageModel.prototype={_securityOriginAdded:function(event)
4140 {var securityOrigin=(event.data);var localStorageKey=this._storageKey(securityOrigin,true);console.assert(!this._storages[localStorageKey]);var localStorage=new WebInspector.DOMStorage(securityOrigin,true);this._storages[localStorageKey]=localStorage;this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded,localStorage);var sessionStorageKey=this._storageKey(securityOrigin,false);console.assert(!this._storages[sessionStorageKey]);var sessionStorage=new WebInspector.DOMStorage(securityOrigin,false);this._storages[sessionStorageKey]=sessionStorage;this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded,sessionStorage);},_securityOriginRemoved:function(event)
4141 {var securityOrigin=(event.data);var localStorageKey=this._storageKey(securityOrigin,true);var localStorage=this._storages[localStorageKey];console.assert(localStorage);delete this._storages[localStorageKey];this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved,localStorage);var sessionStorageKey=this._storageKey(securityOrigin,false);var sessionStorage=this._storages[sessionStorageKey];console.assert(sessionStorage);delete this._storages[sessionStorageKey];this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved,sessionStorage);},_storageKey:function(securityOrigin,isLocalStorage)
4142 {return JSON.stringify(WebInspector.DOMStorage.storageId(securityOrigin,isLocalStorage));},_domStorageItemsCleared:function(storageId)
4143 {var domStorage=this.storageForId(storageId);if(!domStorage)
4144 return;var eventData={};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemsCleared,eventData);},_domStorageItemRemoved:function(storageId,key)
4145 {var domStorage=this.storageForId(storageId);if(!domStorage)
4146 return;var eventData={key:key};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemRemoved,eventData);},_domStorageItemAdded:function(storageId,key,value)
4147 {var domStorage=this.storageForId(storageId);if(!domStorage)
4148 return;var eventData={key:key,value:value};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemAdded,eventData);},_domStorageItemUpdated:function(storageId,key,oldValue,value)
4149 {var domStorage=this.storageForId(storageId);if(!domStorage)
4150 return;var eventData={key:key,oldValue:oldValue,value:value};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemUpdated,eventData);},storageForId:function(storageId)
4151 {return this._storages[JSON.stringify(storageId)];},storages:function()
4152 {var result=[];for(var id in this._storages)
4153 result.push(this._storages[id]);return result;},__proto__:WebInspector.Object.prototype}
4154 WebInspector.DOMStorageDispatcher=function(model)
4155 {this._model=model;}
4156 WebInspector.DOMStorageDispatcher.prototype={domStorageItemsCleared:function(storageId)
4157 {this._model._domStorageItemsCleared(storageId);},domStorageItemRemoved:function(storageId,key)
4158 {this._model._domStorageItemRemoved(storageId,key);},domStorageItemAdded:function(storageId,key,value)
4159 {this._model._domStorageItemAdded(storageId,key,value);},domStorageItemUpdated:function(storageId,key,oldValue,value)
4160 {this._model._domStorageItemUpdated(storageId,key,oldValue,value);},}
4161 WebInspector.domStorageModel;WebInspector.DataGrid=function(columnsArray,editCallback,deleteCallback,refreshCallback,contextMenuCallback)
4162 {WebInspector.View.call(this);this.registerRequiredCSS("dataGrid.css");this.element.className="data-grid";this.element.tabIndex=0;this.element.addEventListener("keydown",this._keyDown.bind(this),false);this._headerTable=document.createElement("table");this._headerTable.className="header";this._headerTableHeaders={};this._dataTable=document.createElement("table");this._dataTable.className="data";this._dataTable.addEventListener("mousedown",this._mouseDownInDataTable.bind(this),true);this._dataTable.addEventListener("click",this._clickInDataTable.bind(this),true);this._dataTable.addEventListener("contextmenu",this._contextMenuInDataTable.bind(this),true);if(editCallback)
4163 this._dataTable.addEventListener("dblclick",this._ondblclick.bind(this),false);this._editCallback=editCallback;this._deleteCallback=deleteCallback;this._refreshCallback=refreshCallback;this._contextMenuCallback=contextMenuCallback;this._scrollContainer=document.createElement("div");this._scrollContainer.className="data-container";this._scrollContainer.appendChild(this._dataTable);this.element.appendChild(this._headerTable);this.element.appendChild(this._scrollContainer);var headerRow=document.createElement("tr");var columnGroup=document.createElement("colgroup");columnGroup.span=columnsArray.length;var fillerRow=document.createElement("tr");fillerRow.className="filler";this._columnsArray=columnsArray;this.columns={};for(var i=0;i<columnsArray.length;++i){var column=columnsArray[i];column.ordinal=i;var columnIdentifier=column.identifier=column.id||i;this.columns[columnIdentifier]=column;if(column.disclosure)
4164 this.disclosureColumnIdentifier=columnIdentifier;var col=document.createElement("col");if(column.width)
4165 col.style.width=column.width;column.element=col;columnGroup.appendChild(col);var cell=document.createElement("th");cell.className=columnIdentifier+"-column";cell.columnIdentifier=columnIdentifier;this._headerTableHeaders[columnIdentifier]=cell;var div=document.createElement("div");if(column.titleDOMFragment)
4166 div.appendChild(column.titleDOMFragment);else
4167 div.textContent=column.title;cell.appendChild(div);if(column.sort){cell.classList.add("sort-"+column.sort);this._sortColumnCell=cell;}
4168 if(column.sortable){cell.addEventListener("click",this._clickInHeaderCell.bind(this),false);cell.classList.add("sortable");}
4169 headerRow.appendChild(cell);fillerRow.createChild("td",columnIdentifier+"-column");}
4170 headerRow.createChild("th","corner");fillerRow.createChild("td","corner");columnGroup.createChild("col","corner");this._headerTableColumnGroup=columnGroup;this._headerTable.appendChild(this._headerTableColumnGroup);this.headerTableBody.appendChild(headerRow);this._dataTableColumnGroup=columnGroup.cloneNode(true);this._dataTable.appendChild(this._dataTableColumnGroup);this.dataTableBody.appendChild(fillerRow);this.selectedNode=null;this.expandNodesWhenArrowing=false;this.setRootNode(new WebInspector.DataGridNode());this.indentWidth=15;this.resizers=[];this._columnWidthsInitialized=false;}
4171 WebInspector.DataGrid.ColumnDescriptor;WebInspector.DataGrid.Events={SelectedNode:"SelectedNode",DeselectedNode:"DeselectedNode",SortingChanged:"SortingChanged",ColumnsResized:"ColumnsResized"}
4172 WebInspector.DataGrid.Order={Ascending:"ascending",Descending:"descending"}
4173 WebInspector.DataGrid.Align={Center:"center",Right:"right"}
4174 WebInspector.DataGrid.createSortableDataGrid=function(columnNames,values)
4175 {var numColumns=columnNames.length;if(!numColumns)
4176 return null;var columns=[];for(var i=0;i<columnNames.length;++i)
4177 columns.push({title:columnNames[i],width:columnNames[i].length,sortable:true});var nodes=[];for(var i=0;i<values.length/numColumns;++i){var data={};for(var j=0;j<columnNames.length;++j)
4178 data[j]=values[numColumns*i+j];var node=new WebInspector.DataGridNode(data,false);node.selectable=false;nodes.push(node);}
4179 var dataGrid=new WebInspector.DataGrid(columns);var length=nodes.length;for(var i=0;i<length;++i)
4180 dataGrid.rootNode().appendChild(nodes[i]);dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,sortDataGrid);function sortDataGrid()
4181 {var nodes=dataGrid._rootNode.children.slice();var sortColumnIdentifier=dataGrid.sortColumnIdentifier();var sortDirection=dataGrid.isSortOrderAscending()?1:-1;var columnIsNumeric=true;for(var i=0;i<nodes.length;i++){var value=nodes[i].data[sortColumnIdentifier];value=value instanceof Node?Number(value.textContent):Number(value);if(isNaN(value)){columnIsNumeric=false;break;}}
4182 function comparator(dataGridNode1,dataGridNode2)
4183 {var item1=dataGridNode1.data[sortColumnIdentifier];var item2=dataGridNode2.data[sortColumnIdentifier];item1=item1 instanceof Node?item1.textContent:String(item1);item2=item2 instanceof Node?item2.textContent:String(item2);var comparison;if(columnIsNumeric){var number1=parseFloat(item1);var number2=parseFloat(item2);comparison=number1<number2?-1:(number1>number2?1:0);}else
4184 comparison=item1<item2?-1:(item1>item2?1:0);return sortDirection*comparison;}
4185 nodes.sort(comparator);dataGrid.rootNode().removeChildren();for(var i=0;i<nodes.length;i++)
4186 dataGrid._rootNode.appendChild(nodes[i]);}
4187 return dataGrid;}
4188 WebInspector.DataGrid.prototype={setRootNode:function(rootNode)
4189 {if(this._rootNode){this._rootNode.removeChildren();this._rootNode.dataGrid=null;this._rootNode._isRoot=false;}
4190 this._rootNode=rootNode;rootNode._isRoot=true;rootNode.hasChildren=false;rootNode._expanded=true;rootNode._revealed=true;rootNode.dataGrid=this;},rootNode:function()
4191 {return this._rootNode;},_ondblclick:function(event)
4192 {if(this._editing||this._editingNode)
4193 return;var columnIdentifier=this.columnIdentifierFromNode(event.target);if(!columnIdentifier||!this.columns[columnIdentifier].editable)
4194 return;this._startEditing(event.target);},_startEditingColumnOfDataGridNode:function(node,columnOrdinal)
4195 {this._editing=true;this._editingNode=node;this._editingNode.select();var element=this._editingNode._element.children[columnOrdinal];WebInspector.startEditing(element,this._startEditingConfig(element));window.getSelection().setBaseAndExtent(element,0,element,1);},_startEditing:function(target)
4196 {var element=target.enclosingNodeOrSelfWithNodeName("td");if(!element)
4197 return;this._editingNode=this.dataGridNodeFromNode(target);if(!this._editingNode){if(!this.creationNode)
4198 return;this._editingNode=this.creationNode;}
4199 if(this._editingNode.isCreationNode)
4200 return this._startEditingColumnOfDataGridNode(this._editingNode,this._nextEditableColumn(-1));this._editing=true;WebInspector.startEditing(element,this._startEditingConfig(element));window.getSelection().setBaseAndExtent(element,0,element,1);},renderInline:function()
4201 {this.element.classList.add("inline");},_startEditingConfig:function(element)
4202 {return new WebInspector.EditingConfig(this._editingCommitted.bind(this),this._editingCancelled.bind(this),element.textContent);},_editingCommitted:function(element,newText,oldText,context,moveDirection)
4203 {var columnIdentifier=this.columnIdentifierFromNode(element);if(!columnIdentifier){this._editingCancelled(element);return;}
4204 var columnOrdinal=this.columns[columnIdentifier].ordinal;var textBeforeEditing=this._editingNode.data[columnIdentifier];var currentEditingNode=this._editingNode;function moveToNextIfNeeded(wasChange){if(!moveDirection)
4205 return;if(moveDirection==="forward"){var firstEditableColumn=this._nextEditableColumn(-1);if(currentEditingNode.isCreationNode&&columnOrdinal===firstEditableColumn&&!wasChange)
4206 return;var nextEditableColumn=this._nextEditableColumn(columnOrdinal);if(nextEditableColumn!==-1)
4207 return this._startEditingColumnOfDataGridNode(currentEditingNode,nextEditableColumn);var nextDataGridNode=currentEditingNode.traverseNextNode(true,null,true);if(nextDataGridNode)
4208 return this._startEditingColumnOfDataGridNode(nextDataGridNode,firstEditableColumn);if(currentEditingNode.isCreationNode&&wasChange){this.addCreationNode(false);return this._startEditingColumnOfDataGridNode(this.creationNode,firstEditableColumn);}
4209 return;}
4210 if(moveDirection==="backward"){var prevEditableColumn=this._nextEditableColumn(columnOrdinal,true);if(prevEditableColumn!==-1)
4211 return this._startEditingColumnOfDataGridNode(currentEditingNode,prevEditableColumn);var lastEditableColumn=this._nextEditableColumn(this._columnsArray.length,true);var nextDataGridNode=currentEditingNode.traversePreviousNode(true,true);if(nextDataGridNode)
4212 return this._startEditingColumnOfDataGridNode(nextDataGridNode,lastEditableColumn);return;}}
4213 if(textBeforeEditing==newText){this._editingCancelled(element);moveToNextIfNeeded.call(this,false);return;}
4214 this._editingNode.data[columnIdentifier]=newText;this._editCallback(this._editingNode,columnIdentifier,textBeforeEditing,newText);if(this._editingNode.isCreationNode)
4215 this.addCreationNode(false);this._editingCancelled(element);moveToNextIfNeeded.call(this,true);},_editingCancelled:function(element)
4216 {delete this._editing;this._editingNode=null;},_nextEditableColumn:function(columnOrdinal,moveBackward)
4217 {var increment=moveBackward?-1:1;var columns=this._columnsArray;for(var i=columnOrdinal+increment;(i>=0)&&(i<columns.length);i+=increment){if(columns[i].editable)
4218 return i;}
4219 return-1;},sortColumnIdentifier:function()
4220 {if(!this._sortColumnCell)
4221 return null;return this._sortColumnCell.columnIdentifier;},sortOrder:function()
4222 {if(!this._sortColumnCell||this._sortColumnCell.classList.contains("sort-ascending"))
4223 return WebInspector.DataGrid.Order.Ascending;if(this._sortColumnCell.classList.contains("sort-descending"))
4224 return WebInspector.DataGrid.Order.Descending;return null;},isSortOrderAscending:function()
4225 {return!this._sortColumnCell||this._sortColumnCell.classList.contains("sort-ascending");},get headerTableBody()
4226 {if("_headerTableBody"in this)
4227 return this._headerTableBody;this._headerTableBody=this._headerTable.getElementsByTagName("tbody")[0];if(!this._headerTableBody){this._headerTableBody=this.element.ownerDocument.createElement("tbody");this._headerTable.insertBefore(this._headerTableBody,this._headerTable.tFoot);}
4228 return this._headerTableBody;},get dataTableBody()
4229 {if("_dataTableBody"in this)
4230 return this._dataTableBody;this._dataTableBody=this._dataTable.getElementsByTagName("tbody")[0];if(!this._dataTableBody){this._dataTableBody=this.element.ownerDocument.createElement("tbody");this._dataTable.insertBefore(this._dataTableBody,this._dataTable.tFoot);}
4231 return this._dataTableBody;},_autoSizeWidths:function(widths,minPercent,maxPercent)
4232 {if(minPercent)
4233 minPercent=Math.min(minPercent,Math.floor(100/widths.length));var totalWidth=0;for(var i=0;i<widths.length;++i)
4234 totalWidth+=widths[i];var totalPercentWidth=0;for(var i=0;i<widths.length;++i){var width=Math.round(100*widths[i]/totalWidth);if(minPercent&&width<minPercent)
4235 width=minPercent;else if(maxPercent&&width>maxPercent)
4236 width=maxPercent;totalPercentWidth+=width;widths[i]=width;}
4237 var recoupPercent=totalPercentWidth-100;while(minPercent&&recoupPercent>0){for(var i=0;i<widths.length;++i){if(widths[i]>minPercent){--widths[i];--recoupPercent;if(!recoupPercent)
4238 break;}}}
4239 while(maxPercent&&recoupPercent<0){for(var i=0;i<widths.length;++i){if(widths[i]<maxPercent){++widths[i];++recoupPercent;if(!recoupPercent)
4240 break;}}}
4241 return widths;},autoSizeColumns:function(minPercent,maxPercent,maxDescentLevel)
4242 {var widths=[];for(var i=0;i<this._columnsArray.length;++i)
4243 widths.push((this._columnsArray[i].title||"").length);maxDescentLevel=maxDescentLevel||0;var children=this._enumerateChildren(this._rootNode,[],maxDescentLevel+1);for(var i=0;i<children.length;++i){var node=children[i];for(var j=0;j<this._columnsArray.length;++j){var text=node.data[this._columnsArray[j].identifier]||"";if(text.length>widths[j])
4244 widths[j]=text.length;}}
4245 widths=this._autoSizeWidths(widths,minPercent,maxPercent);for(var i=0;i<this._columnsArray.length;++i)
4246 this._columnsArray[i].element.style.width=widths[i]+"%";this._columnWidthsInitialized=false;this.updateWidths();},_enumerateChildren:function(rootNode,result,maxLevel)
4247 {if(!rootNode._isRoot)
4248 result.push(rootNode);if(!maxLevel)
4249 return;for(var i=0;i<rootNode.children.length;++i)
4250 this._enumerateChildren(rootNode.children[i],result,maxLevel-1);return result;},onResize:function()
4251 {this.updateWidths();},updateWidths:function()
4252 {var headerTableColumns=this._headerTableColumnGroup.children;var tableWidth=this._dataTable.offsetWidth;var numColumns=headerTableColumns.length-1;if(!this._columnWidthsInitialized&&this.element.offsetWidth){for(var i=0;i<numColumns;i++){var columnWidth=this.headerTableBody.rows[0].cells[i].offsetWidth;var percentWidth=(100*columnWidth/tableWidth)+"%";this._headerTableColumnGroup.children[i].style.width=percentWidth;this._dataTableColumnGroup.children[i].style.width=percentWidth;}
4253 this._columnWidthsInitialized=true;}
4254 this._positionResizers();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},setName:function(name)
4255 {this._columnWeightsSetting=WebInspector.settings.createSetting("dataGrid-"+name+"-columnWeights",{});this._loadColumnWeights();},_loadColumnWeights:function()
4256 {if(!this._columnWeightsSetting)
4257 return;var weights=this._columnWeightsSetting.get();for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];var weight=weights[column.identifier];if(weight)
4258 column.weight=weight;}
4259 this.applyColumnWeights();},_saveColumnWeights:function()
4260 {if(!this._columnWeightsSetting)
4261 return;var weights={};for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];weights[column.identifier]=column.weight;}
4262 this._columnWeightsSetting.set(weights);},wasShown:function()
4263 {this._loadColumnWeights();},applyColumnWeights:function()
4264 {var sumOfWeights=0.0;for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];if(this.isColumnVisible(column))
4265 sumOfWeights+=column.weight;}
4266 for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];var width=this.isColumnVisible(column)?(100*column.weight/sumOfWeights)+"%":"0%";this._headerTableColumnGroup.children[i].style.width=width;this._dataTableColumnGroup.children[i].style.width=width;}
4267 this._positionResizers();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},isColumnVisible:function(column)
4268 {return!column.hidden;},setColumnVisible:function(columnIdentifier,visible)
4269 {if(visible===!this.columns[columnIdentifier].hidden)
4270 return;this.columns[columnIdentifier].hidden=!visible;this.element.enableStyleClass("hide-"+columnIdentifier+"-column",!visible);},get scrollContainer()
4271 {return this._scrollContainer;},isScrolledToLastRow:function()
4272 {return this._scrollContainer.isScrolledToBottom();},scrollToLastRow:function()
4273 {this._scrollContainer.scrollTop=this._scrollContainer.scrollHeight-this._scrollContainer.offsetHeight;},_positionResizers:function()
4274 {var headerTableColumns=this._headerTableColumnGroup.children;var numColumns=headerTableColumns.length-1;var left=0;var previousResizer=null;for(var i=0;i<numColumns-1;i++){var resizer=this.resizers[i];if(!resizer){resizer=document.createElement("div");resizer.classList.add("data-grid-resizer");WebInspector.installDragHandle(resizer,this._startResizerDragging.bind(this),this._resizerDragging.bind(this),this._endResizerDragging.bind(this),"col-resize");this.element.appendChild(resizer);this.resizers[i]=resizer;}
4275 left+=this.headerTableBody.rows[0].cells[i].offsetWidth;if(!this._columnsArray[i].hidden){resizer.style.removeProperty("display");if(resizer._position!==left){resizer._position=left;resizer.style.left=left+"px";}
4276 resizer.leftNeighboringColumnIndex=i;if(previousResizer)
4277 previousResizer.rightNeighboringColumnIndex=i;previousResizer=resizer;}else{if(previousResizer&&previousResizer._position!==left){previousResizer._position=left;previousResizer.style.left=left+"px";}
4278 resizer.style.setProperty("display","none");resizer.leftNeighboringColumnIndex=0;resizer.rightNeighboringColumnIndex=0;}}
4279 if(previousResizer)
4280 previousResizer.rightNeighboringColumnIndex=numColumns-1;},addCreationNode:function(hasChildren)
4281 {if(this.creationNode)
4282 this.creationNode.makeNormal();var emptyData={};for(var column in this.columns)
4283 emptyData[column]=null;this.creationNode=new WebInspector.CreationDataGridNode(emptyData,hasChildren);this.rootNode().appendChild(this.creationNode);},sortNodes:function(comparator,reverseMode)
4284 {function comparatorWrapper(a,b)
4285 {if(a._dataGridNode._data.summaryRow)
4286 return 1;if(b._dataGridNode._data.summaryRow)
4287 return-1;var aDataGirdNode=a._dataGridNode;var bDataGirdNode=b._dataGridNode;return reverseMode?comparator(bDataGirdNode,aDataGirdNode):comparator(aDataGirdNode,bDataGirdNode);}
4288 var tbody=this.dataTableBody;var tbodyParent=tbody.parentElement;tbodyParent.removeChild(tbody);var childNodes=tbody.childNodes;var fillerRow=childNodes[childNodes.length-1];var sortedRows=Array.prototype.slice.call(childNodes,0,childNodes.length-1);sortedRows.sort(comparatorWrapper);var sortedRowsLength=sortedRows.length;tbody.removeChildren();var previousSiblingNode=null;for(var i=0;i<sortedRowsLength;++i){var row=sortedRows[i];var node=row._dataGridNode;node.previousSibling=previousSiblingNode;if(previousSiblingNode)
4289 previousSiblingNode.nextSibling=node;tbody.appendChild(row);previousSiblingNode=node;}
4290 if(previousSiblingNode)
4291 previousSiblingNode.nextSibling=null;tbody.appendChild(fillerRow);tbodyParent.appendChild(tbody);},_keyDown:function(event)
4292 {if(!this.selectedNode||event.shiftKey||event.metaKey||event.ctrlKey||this._editing)
4293 return;var handled=false;var nextSelectedNode;if(event.keyIdentifier==="Up"&&!event.altKey){nextSelectedNode=this.selectedNode.traversePreviousNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
4294 nextSelectedNode=nextSelectedNode.traversePreviousNode(true);handled=nextSelectedNode?true:false;}else if(event.keyIdentifier==="Down"&&!event.altKey){nextSelectedNode=this.selectedNode.traverseNextNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
4295 nextSelectedNode=nextSelectedNode.traverseNextNode(true);handled=nextSelectedNode?true:false;}else if(event.keyIdentifier==="Left"){if(this.selectedNode.expanded){if(event.altKey)
4296 this.selectedNode.collapseRecursively();else
4297 this.selectedNode.collapse();handled=true;}else if(this.selectedNode.parent&&!this.selectedNode.parent._isRoot){handled=true;if(this.selectedNode.parent.selectable){nextSelectedNode=this.selectedNode.parent;handled=nextSelectedNode?true:false;}else if(this.selectedNode.parent)
4298 this.selectedNode.parent.collapse();}}else if(event.keyIdentifier==="Right"){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)
4299 this.selectedNode.expandRecursively();else
4300 this.selectedNode.expand();}}}else if(event.keyCode===8||event.keyCode===46){if(this._deleteCallback){handled=true;this._deleteCallback(this.selectedNode);this.changeNodeAfterDeletion();}}else if(isEnterKey(event)){if(this._editCallback){handled=true;this._startEditing(this.selectedNode._element.children[this._nextEditableColumn(-1)]);}}
4301 if(nextSelectedNode){nextSelectedNode.reveal();nextSelectedNode.select();}
4302 if(handled)
4303 event.consume(true);},changeNodeAfterDeletion:function()
4304 {var nextSelectedNode=this.selectedNode.traverseNextNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
4305 nextSelectedNode=nextSelectedNode.traverseNextNode(true);if(!nextSelectedNode||nextSelectedNode.isCreationNode){nextSelectedNode=this.selectedNode.traversePreviousNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
4306 nextSelectedNode=nextSelectedNode.traversePreviousNode(true);}
4307 if(nextSelectedNode){nextSelectedNode.reveal();nextSelectedNode.select();}},dataGridNodeFromNode:function(target)
4308 {var rowElement=target.enclosingNodeOrSelfWithNodeName("tr");return rowElement&&rowElement._dataGridNode;},columnIdentifierFromNode:function(target)
4309 {var cellElement=target.enclosingNodeOrSelfWithNodeName("td");return cellElement&&cellElement.columnIdentifier_;},_clickInHeaderCell:function(event)
4310 {var cell=event.target.enclosingNodeOrSelfWithNodeName("th");if(!cell||(typeof cell.columnIdentifier==="undefined")||!cell.classList.contains("sortable"))
4311 return;var sortOrder=WebInspector.DataGrid.Order.Ascending;if((cell===this._sortColumnCell)&&this.isSortOrderAscending())
4312 sortOrder=WebInspector.DataGrid.Order.Descending;if(this._sortColumnCell)
4313 this._sortColumnCell.removeMatchingStyleClasses("sort-\\w+");this._sortColumnCell=cell;cell.classList.add("sort-"+sortOrder);this.dispatchEventToListeners(WebInspector.DataGrid.Events.SortingChanged);},markColumnAsSortedBy:function(columnIdentifier,sortOrder)
4314 {if(this._sortColumnCell)
4315 this._sortColumnCell.removeMatchingStyleClasses("sort-\\w+");this._sortColumnCell=this._headerTableHeaders[columnIdentifier];this._sortColumnCell.classList.add("sort-"+sortOrder);},headerTableHeader:function(columnIdentifier)
4316 {return this._headerTableHeaders[columnIdentifier];},_mouseDownInDataTable:function(event)
4317 {var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.selectable)
4318 return;if(gridNode.isEventWithinDisclosureTriangle(event))
4319 return;if(event.metaKey){if(gridNode.selected)
4320 gridNode.deselect();else
4321 gridNode.select();}else
4322 gridNode.select();},_contextMenuInDataTable:function(event)
4323 {var contextMenu=new WebInspector.ContextMenu(event);var gridNode=this.dataGridNodeFromNode(event.target);if(this._refreshCallback&&(!gridNode||gridNode!==this.creationNode))
4324 contextMenu.appendItem(WebInspector.UIString("Refresh"),this._refreshCallback.bind(this));if(gridNode&&gridNode.selectable&&!gridNode.isEventWithinDisclosureTriangle(event)){if(this._editCallback){if(gridNode===this.creationNode)
4325 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add new":"Add New"),this._startEditing.bind(this,event.target));else{var columnIdentifier=this.columnIdentifierFromNode(event.target);if(columnIdentifier&&this.columns[columnIdentifier].editable)
4326 contextMenu.appendItem(WebInspector.UIString("Edit"),this._startEditing.bind(this,event.target));}}
4327 if(this._deleteCallback&&gridNode!==this.creationNode)
4328 contextMenu.appendItem(WebInspector.UIString("Delete"),this._deleteCallback.bind(this,gridNode));if(this._contextMenuCallback)
4329 this._contextMenuCallback(contextMenu,gridNode);}
4330 contextMenu.show();},_clickInDataTable:function(event)
4331 {var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.hasChildren)
4332 return;if(!gridNode.isEventWithinDisclosureTriangle(event))
4333 return;if(gridNode.expanded){if(event.altKey)
4334 gridNode.collapseRecursively();else
4335 gridNode.collapse();}else{if(event.altKey)
4336 gridNode.expandRecursively();else
4337 gridNode.expand();}},get resizeMethod()
4338 {if(typeof this._resizeMethod==="undefined")
4339 return WebInspector.DataGrid.ResizeMethod.Nearest;return this._resizeMethod;},set resizeMethod(method)
4340 {this._resizeMethod=method;},_startResizerDragging:function(event)
4341 {this._currentResizer=event.target;return!!this._currentResizer.rightNeighboringColumnIndex;},_resizerDragging:function(event)
4342 {var resizer=this._currentResizer;if(!resizer)
4343 return;var tableWidth=this._dataTable.offsetWidth;var dragPoint=event.clientX-this.element.totalOffsetLeft();var leftCellIndex=resizer.leftNeighboringColumnIndex;var rightCellIndex=resizer.rightNeighboringColumnIndex;var firstRowCells=this.headerTableBody.rows[0].cells;var leftEdgeOfPreviousColumn=0;for(var i=0;i<leftCellIndex;i++)
4344 leftEdgeOfPreviousColumn+=firstRowCells[i].offsetWidth;if(this.resizeMethod==WebInspector.DataGrid.ResizeMethod.Last){rightCellIndex=this.resizers.length;}else if(this.resizeMethod==WebInspector.DataGrid.ResizeMethod.First){leftEdgeOfPreviousColumn+=firstRowCells[leftCellIndex].offsetWidth-firstRowCells[0].offsetWidth;leftCellIndex=0;}
4345 var rightEdgeOfNextColumn=leftEdgeOfPreviousColumn+firstRowCells[leftCellIndex].offsetWidth+firstRowCells[rightCellIndex].offsetWidth;var leftMinimum=leftEdgeOfPreviousColumn+this.ColumnResizePadding;var rightMaximum=rightEdgeOfNextColumn-this.ColumnResizePadding;if(leftMinimum>rightMaximum)
4346 return;dragPoint=Number.constrain(dragPoint,leftMinimum,rightMaximum);resizer.style.left=(dragPoint-this.CenterResizerOverBorderAdjustment)+"px";var percentLeftColumn=(100*(dragPoint-leftEdgeOfPreviousColumn)/tableWidth)+"%";this._headerTableColumnGroup.children[leftCellIndex].style.width=percentLeftColumn;this._dataTableColumnGroup.children[leftCellIndex].style.width=percentLeftColumn;var percentRightColumn=(100*(rightEdgeOfNextColumn-dragPoint)/tableWidth)+"%";this._headerTableColumnGroup.children[rightCellIndex].style.width=percentRightColumn;this._dataTableColumnGroup.children[rightCellIndex].style.width=percentRightColumn;var leftColumn=this._columnsArray[leftCellIndex];var rightColumn=this._columnsArray[rightCellIndex];if(leftColumn.weight||rightColumn.weight){var sumOfWeights=leftColumn.weight+rightColumn.weight;var delta=rightEdgeOfNextColumn-leftEdgeOfPreviousColumn;leftColumn.weight=(dragPoint-leftEdgeOfPreviousColumn)*sumOfWeights/delta;rightColumn.weight=(rightEdgeOfNextColumn-dragPoint)*sumOfWeights/delta;}
4347 this._positionResizers();event.preventDefault();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},_endResizerDragging:function(event)
4348 {this._currentResizer=null;this._saveColumnWeights();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},ColumnResizePadding:24,CenterResizerOverBorderAdjustment:3,__proto__:WebInspector.View.prototype}
4349 WebInspector.DataGrid.ResizeMethod={Nearest:"nearest",First:"first",Last:"last"}
4350 WebInspector.DataGridNode=function(data,hasChildren)
4351 {this._expanded=false;this._selected=false;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;}
4352 WebInspector.DataGridNode.prototype={selectable:true,_isRoot:false,get element()
4353 {if(this._element)
4354 return this._element;if(!this.dataGrid)
4355 return null;this._element=document.createElement("tr");this._element._dataGridNode=this;if(this.hasChildren)
4356 this._element.classList.add("parent");if(this.expanded)
4357 this._element.classList.add("expanded");if(this.selected)
4358 this._element.classList.add("selected");if(this.revealed)
4359 this._element.classList.add("revealed");this.createCells();this._element.createChild("td","corner");return this._element;},createCells:function()
4360 {var columnsArray=this.dataGrid._columnsArray;for(var i=0;i<columnsArray.length;++i){var cell=this.createCell(columnsArray[i].identifier);this._element.appendChild(cell);}},get data()
4361 {return this._data;},set data(x)
4362 {this._data=x||{};this.refresh();},get revealed()
4363 {if("_revealed"in this)
4364 return this._revealed;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor._isRoot){if(!currentAncestor.expanded){this._revealed=false;return false;}
4365 currentAncestor=currentAncestor.parent;}
4366 this._revealed=true;return true;},set hasChildren(x)
4367 {if(this._hasChildren===x)
4368 return;this._hasChildren=x;if(!this._element)
4369 return;this._element.enableStyleClass("parent",this._hasChildren);this._element.enableStyleClass("expanded",this._hasChildren&&this.expanded);},get hasChildren()
4370 {return this._hasChildren;},set revealed(x)
4371 {if(this._revealed===x)
4372 return;this._revealed=x;if(this._element)
4373 this._element.enableStyleClass("revealed",this._revealed);for(var i=0;i<this.children.length;++i)
4374 this.children[i].revealed=x&&this.expanded;},get depth()
4375 {if("_depth"in this)
4376 return this._depth;if(this.parent&&!this.parent._isRoot)
4377 this._depth=this.parent.depth+1;else
4378 this._depth=0;return this._depth;},get leftPadding()
4379 {if(typeof this._leftPadding==="number")
4380 return this._leftPadding;this._leftPadding=this.depth*this.dataGrid.indentWidth;return this._leftPadding;},get shouldRefreshChildren()
4381 {return this._shouldRefreshChildren;},set shouldRefreshChildren(x)
4382 {this._shouldRefreshChildren=x;if(x&&this.expanded)
4383 this.expand();},get selected()
4384 {return this._selected;},set selected(x)
4385 {if(x)
4386 this.select();else
4387 this.deselect();},get expanded()
4388 {return this._expanded;},set expanded(x)
4389 {if(x)
4390 this.expand();else
4391 this.collapse();},refresh:function()
4392 {if(!this._element||!this.dataGrid)
4393 return;this._element.removeChildren();this.createCells();this._element.createChild("td","corner");},createTD:function(columnIdentifier)
4394 {var cell=document.createElement("td");cell.className=columnIdentifier+"-column";cell.columnIdentifier_=columnIdentifier;var alignment=this.dataGrid.columns[columnIdentifier].align;if(alignment)
4395 cell.classList.add(alignment);return cell;},createCell:function(columnIdentifier)
4396 {var cell=this.createTD(columnIdentifier);var data=this.data[columnIdentifier];var div=document.createElement("div");if(data instanceof Node)
4397 div.appendChild(data);else{div.textContent=data;if(this.dataGrid.columns[columnIdentifier].longText)
4398 div.title=data;}
4399 cell.appendChild(div);if(columnIdentifier===this.dataGrid.disclosureColumnIdentifier){cell.classList.add("disclosure");if(this.leftPadding)
4400 cell.style.setProperty("padding-left",this.leftPadding+"px");}
4401 return cell;},nodeHeight:function()
4402 {var rowHeight=16;if(!this.revealed)
4403 return 0;if(!this.expanded)
4404 return rowHeight;var result=rowHeight;for(var i=0;i<this.children.length;i++)
4405 result+=this.children[i].nodeHeight();return result;},appendChild:function(child)
4406 {this.insertChild(child,this.children.length);},insertChild:function(child,index)
4407 {if(!child)
4408 throw("insertChild: Node can't be undefined or null.");if(child.parent===this)
4409 throw("insertChild: Node is already a child of this node.");if(child.parent)
4410 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;child._shouldRefreshChildren=true;var current=child.children[0];while(current){current.dataGrid=this.dataGrid;delete current._depth;delete current._revealed;delete current._attached;current._shouldRefreshChildren=true;current=current.traverseNextNode(false,child,true);}
4411 if(this.expanded)
4412 child._attach();if(!this.revealed)
4413 child.revealed=false;},removeChild:function(child)
4414 {if(!child)
4415 throw("removeChild: Node can't be undefined or null.");if(child.parent!==this)
4416 throw("removeChild: Node is not a child of this node.");child.deselect();child._detach();this.children.remove(child,true);if(child.previousSibling)
4417 child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
4418 child.nextSibling.previousSibling=child.previousSibling;child.dataGrid=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(this.children.length<=0)
4419 this.hasChildren=false;},removeChildren:function()
4420 {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;}
4421 this.children=[];this.hasChildren=false;},_recalculateSiblings:function(myIndex)
4422 {if(!this.parent)
4423 return;var previousChild=(myIndex>0?this.parent.children[myIndex-1]:null);if(previousChild){previousChild.nextSibling=this;this.previousSibling=previousChild;}else
4424 this.previousSibling=null;var nextChild=this.parent.children[myIndex+1];if(nextChild){nextChild.previousSibling=this;this.nextSibling=nextChild;}else
4425 this.nextSibling=null;},collapse:function()
4426 {if(this._isRoot)
4427 return;if(this._element)
4428 this._element.classList.remove("expanded");this._expanded=false;for(var i=0;i<this.children.length;++i)
4429 this.children[i].revealed=false;},collapseRecursively:function()
4430 {var item=this;while(item){if(item.expanded)
4431 item.collapse();item=item.traverseNextNode(false,this,true);}},populate:function(){},expand:function()
4432 {if(!this.hasChildren||this.expanded)
4433 return;if(this._isRoot)
4434 return;if(this.revealed&&!this._shouldRefreshChildren)
4435 for(var i=0;i<this.children.length;++i)
4436 this.children[i].revealed=true;if(this._shouldRefreshChildren){for(var i=0;i<this.children.length;++i)
4437 this.children[i]._detach();this.populate();if(this._attached){for(var i=0;i<this.children.length;++i){var child=this.children[i];if(this.revealed)
4438 child.revealed=true;child._attach();}}
4439 delete this._shouldRefreshChildren;}
4440 if(this._element)
4441 this._element.classList.add("expanded");this._expanded=true;},expandRecursively:function()
4442 {var item=this;while(item){item.expand();item=item.traverseNextNode(false,this);}},reveal:function()
4443 {if(this._isRoot)
4444 return;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor._isRoot){if(!currentAncestor.expanded)
4445 currentAncestor.expand();currentAncestor=currentAncestor.parent;}
4446 this.element.scrollIntoViewIfNeeded(false);},select:function(supressSelectedEvent)
4447 {if(!this.dataGrid||!this.selectable||this.selected)
4448 return;if(this.dataGrid.selectedNode)
4449 this.dataGrid.selectedNode.deselect();this._selected=true;this.dataGrid.selectedNode=this;if(this._element)
4450 this._element.classList.add("selected");if(!supressSelectedEvent)
4451 this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.SelectedNode);},revealAndSelect:function()
4452 {if(this._isRoot)
4453 return;this.reveal();this.select();},deselect:function(supressDeselectedEvent)
4454 {if(!this.dataGrid||this.dataGrid.selectedNode!==this||!this.selected)
4455 return;this._selected=false;this.dataGrid.selectedNode=null;if(this._element)
4456 this._element.classList.remove("selected");if(!supressDeselectedEvent)
4457 this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.DeselectedNode);},traverseNextNode:function(skipHidden,stayWithin,dontPopulate,info)
4458 {if(!dontPopulate&&this.hasChildren)
4459 this.populate();if(info)
4460 info.depthChange=0;var node=(!skipHidden||this.revealed)?this.children[0]:null;if(node&&(!skipHidden||this.expanded)){if(info)
4461 info.depthChange=1;return node;}
4462 if(this===stayWithin)
4463 return null;node=(!skipHidden||this.revealed)?this.nextSibling:null;if(node)
4464 return node;node=this;while(node&&!node._isRoot&&!((!skipHidden||node.revealed)?node.nextSibling:null)&&node.parent!==stayWithin){if(info)
4465 info.depthChange-=1;node=node.parent;}
4466 if(!node)
4467 return null;return(!skipHidden||node.revealed)?node.nextSibling:null;},traversePreviousNode:function(skipHidden,dontPopulate)
4468 {var node=(!skipHidden||this.revealed)?this.previousSibling:null;if(!dontPopulate&&node&&node.hasChildren)
4469 node.populate();while(node&&((!skipHidden||(node.revealed&&node.expanded))?node.children[node.children.length-1]:null)){if(!dontPopulate&&node.hasChildren)
4470 node.populate();node=((!skipHidden||(node.revealed&&node.expanded))?node.children[node.children.length-1]:null);}
4471 if(node)
4472 return node;if(!this.parent||this.parent._isRoot)
4473 return null;return this.parent;},isEventWithinDisclosureTriangle:function(event)
4474 {if(!this.hasChildren)
4475 return false;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell.classList.contains("disclosure"))
4476 return false;var left=cell.totalOffsetLeft()+this.leftPadding;return event.pageX>=left&&event.pageX<=left+this.disclosureToggleWidth;},_attach:function()
4477 {if(!this.dataGrid||this._attached)
4478 return;this._attached=true;var nextNode=null;var previousNode=this.traversePreviousNode(true,true);if(previousNode&&previousNode.element.parentNode&&previousNode.element.nextSibling)
4479 nextNode=previousNode.element.nextSibling;if(!nextNode)
4480 nextNode=this.dataGrid.dataTableBody.firstChild;this.dataGrid.dataTableBody.insertBefore(this.element,nextNode);if(this.expanded)
4481 for(var i=0;i<this.children.length;++i)
4482 this.children[i]._attach();},_detach:function()
4483 {if(!this._attached)
4484 return;this._attached=false;if(this._element)
4485 this._element.remove();for(var i=0;i<this.children.length;++i)
4486 this.children[i]._detach();this.wasDetached();},wasDetached:function()
4487 {},savePosition:function()
4488 {if(this._savedPosition)
4489 return;if(!this.parent)
4490 throw("savePosition: Node must have a parent.");this._savedPosition={parent:this.parent,index:this.parent.children.indexOf(this)};},restorePosition:function()
4491 {if(!this._savedPosition)
4492 return;if(this.parent!==this._savedPosition.parent)
4493 this._savedPosition.parent.insertChild(this,this._savedPosition.index);delete this._savedPosition;},__proto__:WebInspector.Object.prototype}
4494 WebInspector.CreationDataGridNode=function(data,hasChildren)
4495 {WebInspector.DataGridNode.call(this,data,hasChildren);this.isCreationNode=true;}
4496 WebInspector.CreationDataGridNode.prototype={makeNormal:function()
4497 {delete this.isCreationNode;delete this.makeNormal;},__proto__:WebInspector.DataGridNode.prototype}
4498 WebInspector.ShowMoreDataGridNode=function(callback,startPosition,endPosition,chunkSize)
4499 {WebInspector.DataGridNode.call(this,{summaryRow:true},false);this._callback=callback;this._startPosition=startPosition;this._endPosition=endPosition;this._chunkSize=chunkSize;this.showNext=document.createElement("button");this.showNext.setAttribute("type","button");this.showNext.addEventListener("click",this._showNextChunk.bind(this),false);this.showNext.textContent=WebInspector.UIString("Show %d before",this._chunkSize);this.showAll=document.createElement("button");this.showAll.setAttribute("type","button");this.showAll.addEventListener("click",this._showAll.bind(this),false);this.showLast=document.createElement("button");this.showLast.setAttribute("type","button");this.showLast.addEventListener("click",this._showLastChunk.bind(this),false);this.showLast.textContent=WebInspector.UIString("Show %d after",this._chunkSize);this._updateLabels();this.selectable=false;}
4500 WebInspector.ShowMoreDataGridNode.prototype={_showNextChunk:function()
4501 {this._callback(this._startPosition,this._startPosition+this._chunkSize);},_showAll:function()
4502 {this._callback(this._startPosition,this._endPosition);},_showLastChunk:function()
4503 {this._callback(this._endPosition-this._chunkSize,this._endPosition);},_updateLabels:function()
4504 {var totalSize=this._endPosition-this._startPosition;if(totalSize>this._chunkSize){this.showNext.classList.remove("hidden");this.showLast.classList.remove("hidden");}else{this.showNext.classList.add("hidden");this.showLast.classList.add("hidden");}
4505 this.showAll.textContent=WebInspector.UIString("Show all %d",totalSize);},createCells:function()
4506 {var cell=document.createElement("td");if(this.depth)
4507 cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px");cell.appendChild(this.showNext);cell.appendChild(this.showAll);cell.appendChild(this.showLast);this._element.appendChild(cell);var columns=this.dataGrid.columns;var count=0;for(var c in columns)
4508 ++count;while(--count>0){cell=document.createElement("td");this._element.appendChild(cell);}},setStartPosition:function(from)
4509 {this._startPosition=from;this._updateLabels();},setEndPosition:function(to)
4510 {this._endPosition=to;this._updateLabels();},nodeHeight:function()
4511 {return 32;},dispose:function()
4512 {},__proto__:WebInspector.DataGridNode.prototype}
4513 WebInspector.CookiesTable=function(expandable,refreshCallback,selectedCallback)
4514 {WebInspector.View.call(this);this.element.className="fill";var readOnly=expandable;this._refreshCallback=refreshCallback;var columns=[{id:"name",title:WebInspector.UIString("Name"),sortable:true,disclosure:expandable,sort:WebInspector.DataGrid.Order.Ascending,longText:true,weight:24},{id:"value",title:WebInspector.UIString("Value"),sortable:true,longText:true,weight:34},{id:"domain",title:WebInspector.UIString("Domain"),sortable:true,weight:7},{id:"path",title:WebInspector.UIString("Path"),sortable:true,weight:7},{id:"expires",title:WebInspector.UIString("Expires / Max-Age"),sortable:true,weight:7},{id:"size",title:WebInspector.UIString("Size"),sortable:true,align:WebInspector.DataGrid.Align.Right,weight:7},{id:"httpOnly",title:WebInspector.UIString("HTTP"),sortable:true,align:WebInspector.DataGrid.Align.Center,weight:7},{id:"secure",title:WebInspector.UIString("Secure"),sortable:true,align:WebInspector.DataGrid.Align.Center,weight:7}];if(readOnly)
4515 this._dataGrid=new WebInspector.DataGrid(columns);else
4516 this._dataGrid=new WebInspector.DataGrid(columns,undefined,this._onDeleteCookie.bind(this),refreshCallback,this._onContextMenu.bind(this));this._dataGrid.setName("cookiesTable");this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,this._rebuildTable,this);if(selectedCallback)
4517 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,selectedCallback,this);this._nextSelectedCookie=(null);this._dataGrid.show(this.element);this._data=[];}
4518 WebInspector.CookiesTable.prototype={_clearAndRefresh:function(domain)
4519 {this.clear(domain);this._refresh();},_onContextMenu:function(contextMenu,node)
4520 {if(node===this._dataGrid.creationNode)
4521 return;var cookie=node.cookie;var domain=cookie.domain();if(domain)
4522 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Clear all from \"%s\"":"Clear All from \"%s\"",domain),this._clearAndRefresh.bind(this,domain));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Clear all":"Clear All"),this._clearAndRefresh.bind(this,null));},setCookies:function(cookies)
4523 {this.setCookieFolders([{cookies:cookies}]);},setCookieFolders:function(cookieFolders)
4524 {this._data=cookieFolders;this._rebuildTable();},selectedCookie:function()
4525 {var node=this._dataGrid.selectedNode;return node?node.cookie:null;},clear:function(domain)
4526 {for(var i=0,length=this._data.length;i<length;++i){var cookies=this._data[i].cookies;for(var j=0,cookieCount=cookies.length;j<cookieCount;++j){if(!domain||cookies[j].domain()===domain)
4527 cookies[j].remove();}}},_rebuildTable:function()
4528 {var selectedCookie=this._nextSelectedCookie||this.selectedCookie();this._nextSelectedCookie=null;this._dataGrid.rootNode().removeChildren();for(var i=0;i<this._data.length;++i){var item=this._data[i];if(item.folderName){var groupData={name:item.folderName,value:"",domain:"",path:"",expires:"",size:this._totalSize(item.cookies),httpOnly:"",secure:""};var groupNode=new WebInspector.DataGridNode(groupData);groupNode.selectable=true;this._dataGrid.rootNode().appendChild(groupNode);groupNode.element.classList.add("row-group");this._populateNode(groupNode,item.cookies,selectedCookie);groupNode.expand();}else
4529 this._populateNode(this._dataGrid.rootNode(),item.cookies,selectedCookie);}},_populateNode:function(parentNode,cookies,selectedCookie)
4530 {parentNode.removeChildren();if(!cookies)
4531 return;this._sortCookies(cookies);for(var i=0;i<cookies.length;++i){var cookie=cookies[i];var cookieNode=this._createGridNode(cookie);parentNode.appendChild(cookieNode);if(selectedCookie&&selectedCookie.name()===cookie.name()&&selectedCookie.domain()===cookie.domain()&&selectedCookie.path()===cookie.path())
4532 cookieNode.select();}},_totalSize:function(cookies)
4533 {var totalSize=0;for(var i=0;cookies&&i<cookies.length;++i)
4534 totalSize+=cookies[i].size();return totalSize;},_sortCookies:function(cookies)
4535 {var sortDirection=this._dataGrid.isSortOrderAscending()?1:-1;function compareTo(getter,cookie1,cookie2)
4536 {return sortDirection*(getter.apply(cookie1)+"").compareTo(getter.apply(cookie2)+"")}
4537 function numberCompare(getter,cookie1,cookie2)
4538 {return sortDirection*(getter.apply(cookie1)-getter.apply(cookie2));}
4539 function expiresCompare(cookie1,cookie2)
4540 {if(cookie1.session()!==cookie2.session())
4541 return sortDirection*(cookie1.session()?1:-1);if(cookie1.session())
4542 return 0;if(cookie1.maxAge()&&cookie2.maxAge())
4543 return sortDirection*(cookie1.maxAge()-cookie2.maxAge());if(cookie1.expires()&&cookie2.expires())
4544 return sortDirection*(cookie1.expires()-cookie2.expires());return sortDirection*(cookie1.expires()?1:-1);}
4545 var comparator;switch(this._dataGrid.sortColumnIdentifier()){case"name":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.name);break;case"value":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.value);break;case"domain":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.domain);break;case"path":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.path);break;case"expires":comparator=expiresCompare;break;case"size":comparator=numberCompare.bind(null,WebInspector.Cookie.prototype.size);break;case"httpOnly":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.httpOnly);break;case"secure":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.secure);break;default:compareTo.bind(null,WebInspector.Cookie.prototype.name);}
4546 cookies.sort(comparator);},_createGridNode:function(cookie)
4547 {var data={};data.name=cookie.name();data.value=cookie.value();if(cookie.type()===WebInspector.Cookie.Type.Request){data.domain=WebInspector.UIString("N/A");data.path=WebInspector.UIString("N/A");data.expires=WebInspector.UIString("N/A");}else{data.domain=cookie.domain()||"";data.path=cookie.path()||"";if(cookie.maxAge())
4548 data.expires=Number.secondsToString(parseInt(cookie.maxAge(),10));else if(cookie.expires())
4549 data.expires=new Date(cookie.expires()).toGMTString();else
4550 data.expires=WebInspector.UIString("Session");}
4551 data.size=cookie.size();const checkmark="\u2713";data.httpOnly=(cookie.httpOnly()?checkmark:"");data.secure=(cookie.secure()?checkmark:"");var node=new WebInspector.DataGridNode(data);node.cookie=cookie;node.selectable=true;return node;},_onDeleteCookie:function(node)
4552 {var cookie=node.cookie;var neighbour=node.traverseNextNode()||node.traversePreviousNode();if(neighbour)
4553 this._nextSelectedCookie=neighbour.cookie;cookie.remove();this._refresh();},_refresh:function()
4554 {if(this._refreshCallback)
4555 this._refreshCallback();},__proto__:WebInspector.View.prototype}
4556 WebInspector.CookieItemsView=function(treeElement,cookieDomain)
4557 {WebInspector.View.call(this);this.element.classList.add("storage-view");this._deleteButton=new WebInspector.StatusBarButton(WebInspector.UIString("Delete"),"delete-storage-status-bar-item");this._deleteButton.visible=false;this._deleteButton.addEventListener("click",this._deleteButtonClicked,this);this._clearButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear"),"clear-storage-status-bar-item");this._clearButton.visible=false;this._clearButton.addEventListener("click",this._clearButtonClicked,this);this._refreshButton=new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"),"refresh-storage-status-bar-item");this._refreshButton.addEventListener("click",this._refreshButtonClicked,this);this._treeElement=treeElement;this._cookieDomain=cookieDomain;this._emptyView=new WebInspector.EmptyView(WebInspector.UIString("This site has no cookies."));this._emptyView.show(this.element);this.element.addEventListener("contextmenu",this._contextMenu.bind(this),true);}
4558 WebInspector.CookieItemsView.prototype={get statusBarItems()
4559 {return[this._refreshButton.element,this._clearButton.element,this._deleteButton.element];},wasShown:function()
4560 {this._update();},willHide:function()
4561 {this._deleteButton.visible=false;},_update:function()
4562 {WebInspector.Cookies.getCookiesAsync(this._updateWithCookies.bind(this));},_updateWithCookies:function(allCookies)
4563 {this._cookies=this._filterCookiesForDomain(allCookies);if(!this._cookies.length){this._emptyView.show(this.element);this._clearButton.visible=false;this._deleteButton.visible=false;if(this._cookiesTable)
4564 this._cookiesTable.detach();return;}
4565 if(!this._cookiesTable)
4566 this._cookiesTable=new WebInspector.CookiesTable(false,this._update.bind(this),this._showDeleteButton.bind(this));this._cookiesTable.setCookies(this._cookies);this._emptyView.detach();this._cookiesTable.show(this.element);this._treeElement.subtitle=String.sprintf(WebInspector.UIString("%d cookies (%s)"),this._cookies.length,Number.bytesToString(this._totalSize));this._clearButton.visible=true;this._deleteButton.visible=!!this._cookiesTable.selectedCookie();},_filterCookiesForDomain:function(allCookies)
4567 {var cookies=[];var resourceURLsForDocumentURL=[];this._totalSize=0;function populateResourcesForDocuments(resource)
4568 {var url=resource.documentURL.asParsedURL();if(url&&url.host==this._cookieDomain)
4569 resourceURLsForDocumentURL.push(resource.url);}
4570 WebInspector.forAllResources(populateResourcesForDocuments.bind(this));for(var i=0;i<allCookies.length;++i){var pushed=false;var size=allCookies[i].size();for(var j=0;j<resourceURLsForDocumentURL.length;++j){var resourceURL=resourceURLsForDocumentURL[j];if(WebInspector.Cookies.cookieMatchesResourceURL(allCookies[i],resourceURL)){this._totalSize+=size;if(!pushed){pushed=true;cookies.push(allCookies[i]);}}}}
4571 return cookies;},clear:function()
4572 {this._cookiesTable.clear();this._update();},_clearButtonClicked:function()
4573 {this.clear();},_showDeleteButton:function()
4574 {this._deleteButton.visible=true;},_deleteButtonClicked:function()
4575 {var selectedCookie=this._cookiesTable.selectedCookie();if(selectedCookie){selectedCookie.remove();this._update();}},_refreshButtonClicked:function(event)
4576 {this._update();},_contextMenu:function(event)
4577 {if(!this._cookies.length){var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString("Refresh"),this._update.bind(this));contextMenu.show();}},__proto__:WebInspector.View.prototype}
4578 WebInspector.ApplicationCacheModel=function()
4579 {ApplicationCacheAgent.enable();InspectorBackend.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheDispatcher(this));WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,this._frameNavigated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this._frameDetached,this);this._statuses={};this._manifestURLsByFrame={};this._mainFrameNavigated();this._onLine=true;}
4580 WebInspector.ApplicationCacheModel.EventTypes={FrameManifestStatusUpdated:"FrameManifestStatusUpdated",FrameManifestAdded:"FrameManifestAdded",FrameManifestRemoved:"FrameManifestRemoved",NetworkStateChanged:"NetworkStateChanged"}
4581 WebInspector.ApplicationCacheModel.prototype={_frameNavigated:function(event)
4582 {var frame=(event.data);if(frame.isMainFrame()){this._mainFrameNavigated();return;}
4583 ApplicationCacheAgent.getManifestForFrame(frame.id,this._manifestForFrameLoaded.bind(this,frame.id));},_frameDetached:function(event)
4584 {var frame=(event.data);this._frameManifestRemoved(frame.id);},_mainFrameNavigated:function()
4585 {ApplicationCacheAgent.getFramesWithManifests(this._framesWithManifestsLoaded.bind(this));},_manifestForFrameLoaded:function(frameId,error,manifestURL)
4586 {if(error){console.error(error);return;}
4587 if(!manifestURL)
4588 this._frameManifestRemoved(frameId);},_framesWithManifestsLoaded:function(error,framesWithManifests)
4589 {if(error){console.error(error);return;}
4590 for(var i=0;i<framesWithManifests.length;++i)
4591 this._frameManifestUpdated(framesWithManifests[i].frameId,framesWithManifests[i].manifestURL,framesWithManifests[i].status);},_frameManifestUpdated:function(frameId,manifestURL,status)
4592 {if(status===applicationCache.UNCACHED){this._frameManifestRemoved(frameId);return;}
4593 if(!manifestURL)
4594 return;if(this._manifestURLsByFrame[frameId]&&manifestURL!==this._manifestURLsByFrame[frameId])
4595 this._frameManifestRemoved(frameId);var statusChanged=this._statuses[frameId]!==status;this._statuses[frameId]=status;if(!this._manifestURLsByFrame[frameId]){this._manifestURLsByFrame[frameId]=manifestURL;this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestAdded,frameId);}
4596 if(statusChanged)
4597 this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestStatusUpdated,frameId);},_frameManifestRemoved:function(frameId)
4598 {if(!this._manifestURLsByFrame[frameId])
4599 return;var manifestURL=this._manifestURLsByFrame[frameId];delete this._manifestURLsByFrame[frameId];delete this._statuses[frameId];this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestRemoved,frameId);},frameManifestURL:function(frameId)
4600 {return this._manifestURLsByFrame[frameId]||"";},frameManifestStatus:function(frameId)
4601 {return this._statuses[frameId]||applicationCache.UNCACHED;},get onLine()
4602 {return this._onLine;},_statusUpdated:function(frameId,manifestURL,status)
4603 {this._frameManifestUpdated(frameId,manifestURL,status);},requestApplicationCache:function(frameId,callback)
4604 {function callbackWrapper(error,applicationCache)
4605 {if(error){console.error(error);callback(null);return;}
4606 callback(applicationCache);}
4607 ApplicationCacheAgent.getApplicationCacheForFrame(frameId,callbackWrapper.bind(this));},_networkStateUpdated:function(isNowOnline)
4608 {this._onLine=isNowOnline;this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged,isNowOnline);},__proto__:WebInspector.Object.prototype}
4609 WebInspector.ApplicationCacheDispatcher=function(applicationCacheModel)
4610 {this._applicationCacheModel=applicationCacheModel;}
4611 WebInspector.ApplicationCacheDispatcher.prototype={applicationCacheStatusUpdated:function(frameId,manifestURL,status)
4612 {this._applicationCacheModel._statusUpdated(frameId,manifestURL,status);},networkStateUpdated:function(isNowOnline)
4613 {this._applicationCacheModel._networkStateUpdated(isNowOnline);}}
4614 WebInspector.IndexedDBModel=function()
4615 {IndexedDBAgent.enable();WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);this._databases=new Map();this._databaseNamesBySecurityOrigin={};this._reset();}
4616 WebInspector.IndexedDBModel.KeyTypes={NumberType:"number",StringType:"string",DateType:"date",ArrayType:"array"};WebInspector.IndexedDBModel.KeyPathTypes={NullType:"null",StringType:"string",ArrayType:"array"};WebInspector.IndexedDBModel.keyFromIDBKey=function(idbKey)
4617 {if(typeof(idbKey)==="undefined"||idbKey===null)
4618 return null;var key={};switch(typeof(idbKey)){case"number":key.number=idbKey;key.type=WebInspector.IndexedDBModel.KeyTypes.NumberType;break;case"string":key.string=idbKey;key.type=WebInspector.IndexedDBModel.KeyTypes.StringType;break;case"object":if(idbKey instanceof Date){key.date=idbKey.getTime();key.type=WebInspector.IndexedDBModel.KeyTypes.DateType;}else if(idbKey instanceof Array){key.array=[];for(var i=0;i<idbKey.length;++i)
4619 key.array.push(WebInspector.IndexedDBModel.keyFromIDBKey(idbKey[i]));key.type=WebInspector.IndexedDBModel.KeyTypes.ArrayType;}
4620 break;default:return null;}
4621 return key;}
4622 WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange=function(idbKeyRange)
4623 {var IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange;if(typeof(idbKeyRange)==="undefined"||idbKeyRange===null)
4624 return null;var keyRange={};keyRange.lower=WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.lower);keyRange.upper=WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.upper);keyRange.lowerOpen=idbKeyRange.lowerOpen;keyRange.upperOpen=idbKeyRange.upperOpen;return keyRange;}
4625 WebInspector.IndexedDBModel.idbKeyPathFromKeyPath=function(keyPath)
4626 {var idbKeyPath;switch(keyPath.type){case WebInspector.IndexedDBModel.KeyPathTypes.NullType:idbKeyPath=null;break;case WebInspector.IndexedDBModel.KeyPathTypes.StringType:idbKeyPath=keyPath.string;break;case WebInspector.IndexedDBModel.KeyPathTypes.ArrayType:idbKeyPath=keyPath.array;break;}
4627 return idbKeyPath;}
4628 WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath=function(idbKeyPath)
4629 {if(typeof idbKeyPath==="string")
4630 return"\""+idbKeyPath+"\"";if(idbKeyPath instanceof Array)
4631 return"[\""+idbKeyPath.join("\", \"")+"\"]";return null;}
4632 WebInspector.IndexedDBModel.EventTypes={DatabaseAdded:"DatabaseAdded",DatabaseRemoved:"DatabaseRemoved",DatabaseLoaded:"DatabaseLoaded"}
4633 WebInspector.IndexedDBModel.prototype={_reset:function()
4634 {for(var securityOrigin in this._databaseNamesBySecurityOrigin)
4635 this._removeOrigin(securityOrigin);var securityOrigins=WebInspector.resourceTreeModel.securityOrigins();for(var i=0;i<securityOrigins.length;++i)
4636 this._addOrigin(securityOrigins[i]);},refreshDatabaseNames:function()
4637 {for(var securityOrigin in this._databaseNamesBySecurityOrigin)
4638 this._loadDatabaseNames(securityOrigin);},refreshDatabase:function(databaseId)
4639 {this._loadDatabase(databaseId);},clearObjectStore:function(databaseId,objectStoreName,callback)
4640 {IndexedDBAgent.clearObjectStore(databaseId.securityOrigin,databaseId.name,objectStoreName,callback);},_securityOriginAdded:function(event)
4641 {var securityOrigin=(event.data);this._addOrigin(securityOrigin);},_securityOriginRemoved:function(event)
4642 {var securityOrigin=(event.data);this._removeOrigin(securityOrigin);},_addOrigin:function(securityOrigin)
4643 {console.assert(!this._databaseNamesBySecurityOrigin[securityOrigin]);this._databaseNamesBySecurityOrigin[securityOrigin]=[];this._loadDatabaseNames(securityOrigin);},_removeOrigin:function(securityOrigin)
4644 {console.assert(this._databaseNamesBySecurityOrigin[securityOrigin]);for(var i=0;i<this._databaseNamesBySecurityOrigin[securityOrigin].length;++i)
4645 this._databaseRemoved(securityOrigin,this._databaseNamesBySecurityOrigin[securityOrigin][i]);delete this._databaseNamesBySecurityOrigin[securityOrigin];},_updateOriginDatabaseNames:function(securityOrigin,databaseNames)
4646 {var newDatabaseNames={};for(var i=0;i<databaseNames.length;++i)
4647 newDatabaseNames[databaseNames[i]]=true;var oldDatabaseNames={};for(var i=0;i<this._databaseNamesBySecurityOrigin[securityOrigin].length;++i)
4648 oldDatabaseNames[this._databaseNamesBySecurityOrigin[securityOrigin][i]]=true;this._databaseNamesBySecurityOrigin[securityOrigin]=databaseNames;for(var databaseName in oldDatabaseNames){if(!newDatabaseNames[databaseName])
4649 this._databaseRemoved(securityOrigin,databaseName);}
4650 for(var databaseName in newDatabaseNames){if(!oldDatabaseNames[databaseName])
4651 this._databaseAdded(securityOrigin,databaseName);}},_databaseAdded:function(securityOrigin,databaseName)
4652 {var databaseId=new WebInspector.IndexedDBModel.DatabaseId(securityOrigin,databaseName);this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseAdded,databaseId);},_databaseRemoved:function(securityOrigin,databaseName)
4653 {var databaseId=new WebInspector.IndexedDBModel.DatabaseId(securityOrigin,databaseName);this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseRemoved,databaseId);},_loadDatabaseNames:function(securityOrigin)
4654 {function callback(error,databaseNames)
4655 {if(error){console.error("IndexedDBAgent error: "+error);return;}
4656 if(!this._databaseNamesBySecurityOrigin[securityOrigin])
4657 return;this._updateOriginDatabaseNames(securityOrigin,databaseNames);}
4658 IndexedDBAgent.requestDatabaseNames(securityOrigin,callback.bind(this));},_loadDatabase:function(databaseId)
4659 {function callback(error,databaseWithObjectStores)
4660 {if(error){console.error("IndexedDBAgent error: "+error);return;}
4661 if(!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])
4662 return;var databaseModel=new WebInspector.IndexedDBModel.Database(databaseId,databaseWithObjectStores.version,databaseWithObjectStores.intVersion);this._databases.put(databaseId,databaseModel);for(var i=0;i<databaseWithObjectStores.objectStores.length;++i){var objectStore=databaseWithObjectStores.objectStores[i];var objectStoreIDBKeyPath=WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(objectStore.keyPath);var objectStoreModel=new WebInspector.IndexedDBModel.ObjectStore(objectStore.name,objectStoreIDBKeyPath,objectStore.autoIncrement);for(var j=0;j<objectStore.indexes.length;++j){var index=objectStore.indexes[j];var indexIDBKeyPath=WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(index.keyPath);var indexModel=new WebInspector.IndexedDBModel.Index(index.name,indexIDBKeyPath,index.unique,index.multiEntry);objectStoreModel.indexes[indexModel.name]=indexModel;}
4663 databaseModel.objectStores[objectStoreModel.name]=objectStoreModel;}
4664 this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseLoaded,databaseModel);}
4665 IndexedDBAgent.requestDatabase(databaseId.securityOrigin,databaseId.name,callback.bind(this));},loadObjectStoreData:function(databaseId,objectStoreName,idbKeyRange,skipCount,pageSize,callback)
4666 {this._requestData(databaseId,databaseId.name,objectStoreName,"",idbKeyRange,skipCount,pageSize,callback);},loadIndexData:function(databaseId,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback)
4667 {this._requestData(databaseId,databaseId.name,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback);},_requestData:function(databaseId,databaseName,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback)
4668 {function innerCallback(error,dataEntries,hasMore)
4669 {if(error){console.error("IndexedDBAgent error: "+error);return;}
4670 if(!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])
4671 return;var entries=[];for(var i=0;i<dataEntries.length;++i){var key=WebInspector.RemoteObject.fromPayload(dataEntries[i].key);var primaryKey=WebInspector.RemoteObject.fromPayload(dataEntries[i].primaryKey);var value=WebInspector.RemoteObject.fromPayload(dataEntries[i].value);entries.push(new WebInspector.IndexedDBModel.Entry(key,primaryKey,value));}
4672 callback(entries,hasMore);}
4673 var keyRange=WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange);IndexedDBAgent.requestData(databaseId.securityOrigin,databaseName,objectStoreName,indexName,skipCount,pageSize,keyRange?keyRange:undefined,innerCallback.bind(this));},__proto__:WebInspector.Object.prototype}
4674 WebInspector.IndexedDBModel.Entry=function(key,primaryKey,value)
4675 {this.key=key;this.primaryKey=primaryKey;this.value=value;}
4676 WebInspector.IndexedDBModel.DatabaseId=function(securityOrigin,name)
4677 {this.securityOrigin=securityOrigin;this.name=name;}
4678 WebInspector.IndexedDBModel.DatabaseId.prototype={equals:function(databaseId)
4679 {return this.name===databaseId.name&&this.securityOrigin===databaseId.securityOrigin;},}
4680 WebInspector.IndexedDBModel.Database=function(databaseId,version,intVersion)
4681 {this.databaseId=databaseId;this.version=version;this.intVersion=intVersion;this.objectStores={};}
4682 WebInspector.IndexedDBModel.ObjectStore=function(name,keyPath,autoIncrement)
4683 {this.name=name;this.keyPath=keyPath;this.autoIncrement=autoIncrement;this.indexes={};}
4684 WebInspector.IndexedDBModel.ObjectStore.prototype={get keyPathString()
4685 {return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyPath);}}
4686 WebInspector.IndexedDBModel.Index=function(name,keyPath,unique,multiEntry)
4687 {this.name=name;this.keyPath=keyPath;this.unique=unique;this.multiEntry=multiEntry;}
4688 WebInspector.IndexedDBModel.Index.prototype={get keyPathString()
4689 {return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyPath);}}
4690 WebInspector.Spectrum=function()
4691 {WebInspector.View.call(this);this.registerRequiredCSS("spectrum.css");this.element.className="spectrum-container";this.element.tabIndex=0;var topElement=this.element.createChild("div","spectrum-top");topElement.createChild("div","spectrum-fill");var topInnerElement=topElement.createChild("div","spectrum-top-inner fill");this._draggerElement=topInnerElement.createChild("div","spectrum-color");this._dragHelperElement=this._draggerElement.createChild("div","spectrum-sat fill").createChild("div","spectrum-val fill").createChild("div","spectrum-dragger");this._sliderElement=topInnerElement.createChild("div","spectrum-hue");this.slideHelper=this._sliderElement.createChild("div","spectrum-slider");var rangeContainer=this.element.createChild("div","spectrum-range-container");var alphaLabel=rangeContainer.createChild("label");alphaLabel.textContent=WebInspector.UIString("\u03B1:");this._alphaElement=rangeContainer.createChild("input","spectrum-range");this._alphaElement.setAttribute("type","range");this._alphaElement.setAttribute("min","0");this._alphaElement.setAttribute("max","100");this._alphaElement.addEventListener("change",alphaDrag.bind(this),false);var swatchElement=document.createElement("span");swatchElement.className="swatch";this._swatchInnerElement=swatchElement.createChild("span","swatch-inner");var displayContainer=this.element.createChild("div");displayContainer.appendChild(swatchElement);this._displayElement=displayContainer.createChild("span","source-code spectrum-display-value");WebInspector.Spectrum.draggable(this._sliderElement,hueDrag.bind(this));WebInspector.Spectrum.draggable(this._draggerElement,colorDrag.bind(this),colorDragStart.bind(this));function hueDrag(element,dragX,dragY)
4692 {this._hsv[0]=(this.slideHeight-dragY)/this.slideHeight;this._onchange();}
4693 var initialHelperOffset;function colorDragStart()
4694 {initialHelperOffset={x:this._dragHelperElement.offsetLeft,y:this._dragHelperElement.offsetTop};}
4695 function colorDrag(element,dragX,dragY,event)
4696 {if(event.shiftKey){if(Math.abs(dragX-initialHelperOffset.x)>=Math.abs(dragY-initialHelperOffset.y))
4697 dragY=initialHelperOffset.y;else
4698 dragX=initialHelperOffset.x;}
4699 this._hsv[1]=dragX/this.dragWidth;this._hsv[2]=(this.dragHeight-dragY)/this.dragHeight;this._onchange();}
4700 function alphaDrag()
4701 {this._hsv[3]=this._alphaElement.value/100;this._onchange();}};WebInspector.Spectrum.Events={ColorChanged:"ColorChanged"};WebInspector.Spectrum.draggable=function(element,onmove,onstart,onstop){var doc=document;var dragging;var offset;var scrollOffset;var maxHeight;var maxWidth;function consume(e)
4702 {e.consume(true);}
4703 function move(e)
4704 {if(dragging){var dragX=Math.max(0,Math.min(e.pageX-offset.left+scrollOffset.left,maxWidth));var dragY=Math.max(0,Math.min(e.pageY-offset.top+scrollOffset.top,maxHeight));if(onmove)
4705 onmove(element,dragX,dragY,(e));}}
4706 function start(e)
4707 {var mouseEvent=(e);var rightClick=mouseEvent.which?(mouseEvent.which===3):(mouseEvent.button===2);if(!rightClick&&!dragging){if(onstart)
4708 onstart(element,mouseEvent);dragging=true;maxHeight=element.clientHeight;maxWidth=element.clientWidth;scrollOffset=element.scrollOffset();offset=element.totalOffset();doc.addEventListener("selectstart",consume,false);doc.addEventListener("dragstart",consume,false);doc.addEventListener("mousemove",move,false);doc.addEventListener("mouseup",stop,false);move(mouseEvent);consume(mouseEvent);}}
4709 function stop(e)
4710 {if(dragging){doc.removeEventListener("selectstart",consume,false);doc.removeEventListener("dragstart",consume,false);doc.removeEventListener("mousemove",move,false);doc.removeEventListener("mouseup",stop,false);if(onstop)
4711 onstop(element,(e));}
4712 dragging=false;}
4713 element.addEventListener("mousedown",start,false);};WebInspector.Spectrum.prototype={setColor:function(color)
4714 {this._hsv=color.hsva();},color:function()
4715 {return WebInspector.Color.fromHSVA(this._hsv);},_colorString:function()
4716 {var cf=WebInspector.Color.Format;var format=this._originalFormat;var color=this.color();var originalFormatString=color.toString(this._originalFormat);if(originalFormatString)
4717 return originalFormatString;if(color.hasAlpha()){if(format===cf.HSLA||format===cf.HSL)
4718 return color.toString(cf.HSLA);else
4719 return color.toString(cf.RGBA);}
4720 if(format===cf.ShortHEX)
4721 return color.toString(cf.HEX);console.assert(format===cf.Nickname);return color.toString(cf.RGB);},set displayText(text)
4722 {this._displayElement.textContent=text;},_onchange:function()
4723 {this._updateUI();this.dispatchEventToListeners(WebInspector.Spectrum.Events.ColorChanged,this._colorString());},_updateHelperLocations:function()
4724 {var h=this._hsv[0];var s=this._hsv[1];var v=this._hsv[2];var dragX=s*this.dragWidth;var dragY=this.dragHeight-(v*this.dragHeight);dragX=Math.max(-this._dragHelperElementHeight,Math.min(this.dragWidth-this._dragHelperElementHeight,dragX-this._dragHelperElementHeight));dragY=Math.max(-this._dragHelperElementHeight,Math.min(this.dragHeight-this._dragHelperElementHeight,dragY-this._dragHelperElementHeight));this._dragHelperElement.positionAt(dragX,dragY);var slideY=this.slideHeight-((h*this.slideHeight)+this.slideHelperHeight);this.slideHelper.style.top=slideY+"px";this._alphaElement.value=this._hsv[3]*100;},_updateUI:function()
4725 {this._updateHelperLocations();this._draggerElement.style.backgroundColor=WebInspector.Color.fromHSVA([this._hsv[0],1,1,1]).toString(WebInspector.Color.Format.RGB);this._swatchInnerElement.style.backgroundColor=this.color().toString(WebInspector.Color.Format.RGBA);this._alphaElement.value=this._hsv[3]*100;},wasShown:function()
4726 {this.slideHeight=this._sliderElement.offsetHeight;this.dragWidth=this._draggerElement.offsetWidth;this.dragHeight=this._draggerElement.offsetHeight;this._dragHelperElementHeight=this._dragHelperElement.offsetHeight/2;this.slideHelperHeight=this.slideHelper.offsetHeight/2;this._updateUI();},__proto__:WebInspector.View.prototype}
4727 WebInspector.SpectrumPopupHelper=function()
4728 {this._spectrum=new WebInspector.Spectrum();this._spectrum.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this._popover=new WebInspector.Popover();this._popover.setCanShrink(false);this._popover.element.addEventListener("mousedown",consumeEvent,false);this._hideProxy=this.hide.bind(this,true);}
4729 WebInspector.SpectrumPopupHelper.Events={Hidden:"Hidden"};WebInspector.SpectrumPopupHelper.prototype={spectrum:function()
4730 {return this._spectrum;},toggle:function(element,color,format)
4731 {if(this._popover.isShowing())
4732 this.hide(true);else
4733 this.show(element,color,format);return this._popover.isShowing();},show:function(element,color,format)
4734 {if(this._popover.isShowing()){if(this._anchorElement===element)
4735 return false;this.hide(true);}
4736 this._anchorElement=element;this._spectrum.setColor(color);this._spectrum._originalFormat=format!==WebInspector.Color.Format.Original?format:color.format();this.reposition(element);document.addEventListener("mousedown",this._hideProxy,false);window.addEventListener("blur",this._hideProxy,false);return true;},reposition:function(element)
4737 {if(!this._previousFocusElement)
4738 this._previousFocusElement=WebInspector.currentFocusElement();this._popover.showView(this._spectrum,element);WebInspector.setCurrentFocusElement(this._spectrum.element);},hide:function(commitEdit)
4739 {if(!this._popover.isShowing())
4740 return;this._popover.hide();document.removeEventListener("mousedown",this._hideProxy,false);window.removeEventListener("blur",this._hideProxy,false);this.dispatchEventToListeners(WebInspector.SpectrumPopupHelper.Events.Hidden,!!commitEdit);WebInspector.setCurrentFocusElement(this._previousFocusElement);delete this._previousFocusElement;delete this._anchorElement;},_onKeyDown:function(event)
4741 {if(event.keyIdentifier==="Enter"){this.hide(true);event.consume(true);return;}
4742 if(event.keyIdentifier==="U+001B"){this.hide(false);event.consume(true);}},__proto__:WebInspector.Object.prototype}
4743 WebInspector.ColorSwatch=function(readOnly)
4744 {this.element=document.createElement("span");this._swatchInnerElement=this.element.createChild("span","swatch-inner");var shiftClickMessage=WebInspector.UIString("Shift-click to change color format.");this.element.title=readOnly?shiftClickMessage:String.sprintf("%s\n%s",WebInspector.UIString("Click to open a colorpicker."),shiftClickMessage);this.element.className="swatch";this.element.addEventListener("mousedown",consumeEvent,false);this.element.addEventListener("dblclick",consumeEvent,false);}
4745 WebInspector.ColorSwatch.prototype={setColorString:function(colorString)
4746 {this._swatchInnerElement.style.backgroundColor=colorString;}}
4747 WebInspector.SidebarPane=function(title)
4748 {WebInspector.View.call(this);this.element.className="sidebar-pane";this.titleElement=document.createElement("div");this.titleElement.className="sidebar-pane-toolbar";this.bodyElement=this.element.createChild("div","body");this._title=title;this._expandCallback=null;}
4749 WebInspector.SidebarPane.EventTypes={wasShown:"wasShown"}
4750 WebInspector.SidebarPane.prototype={title:function()
4751 {return this._title;},prepareContent:function(callback)
4752 {if(callback)
4753 callback();},expand:function()
4754 {this.prepareContent(this.onContentReady.bind(this));},onContentReady:function()
4755 {if(this._expandCallback)
4756 this._expandCallback();else
4757 this._expandPending=true;},setExpandCallback:function(callback)
4758 {this._expandCallback=callback;if(this._expandPending){delete this._expandPending;this._expandCallback();}},wasShown:function()
4759 {WebInspector.View.prototype.wasShown.call(this);this.dispatchEventToListeners(WebInspector.SidebarPane.EventTypes.wasShown);},__proto__:WebInspector.View.prototype}
4760 WebInspector.SidebarPaneTitle=function(container,pane)
4761 {this._pane=pane;this.element=container.createChild("div","sidebar-pane-title");this.element.textContent=pane.title();this.element.tabIndex=0;this.element.addEventListener("click",this._toggleExpanded.bind(this),false);this.element.addEventListener("keydown",this._onTitleKeyDown.bind(this),false);this.element.appendChild(this._pane.titleElement);this._pane.setExpandCallback(this._expand.bind(this));}
4762 WebInspector.SidebarPaneTitle.prototype={_expand:function()
4763 {this.element.classList.add("expanded");this._pane.show(this.element.parentNode,this.element.nextSibling);},_collapse:function()
4764 {this.element.classList.remove("expanded");if(this._pane.element.parentNode==this.element.parentNode)
4765 this._pane.detach();},_toggleExpanded:function()
4766 {if(this.element.classList.contains("expanded"))
4767 this._collapse();else
4768 this._pane.expand();},_onTitleKeyDown:function(event)
4769 {if(isEnterKey(event)||event.keyCode===WebInspector.KeyboardShortcut.Keys.Space.code)
4770 this._toggleExpanded();}}
4771 WebInspector.SidebarPaneStack=function()
4772 {WebInspector.View.call(this);this.element.className="sidebar-pane-stack fill";this.registerRequiredCSS("sidebarPane.css");}
4773 WebInspector.SidebarPaneStack.prototype={addPane:function(pane)
4774 {new WebInspector.SidebarPaneTitle(this.element,pane);},__proto__:WebInspector.View.prototype}
4775 WebInspector.SidebarTabbedPane=function()
4776 {WebInspector.TabbedPane.call(this);this.setRetainTabOrder(true);this.element.classList.add("sidebar-tabbed-pane");this.registerRequiredCSS("sidebarPane.css");}
4777 WebInspector.SidebarTabbedPane.prototype={addPane:function(pane)
4778 {var title=pane.title();this.appendTab(title,title,pane);pane.element.appendChild(pane.titleElement);pane.setExpandCallback(this.selectTab.bind(this,title));},__proto__:WebInspector.TabbedPane.prototype}
4779 WebInspector.ElementsTreeOutline=function(omitRootDOMNode,selectEnabled,contextMenuCallback,setPseudoClassCallback)
4780 {this.element=document.createElement("ol");this.element.className="elements-tree-outline";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.addEventListener("keydown",this._onkeydown.bind(this),false);TreeOutline.call(this,this.element);this._includeRootDOMNode=!omitRootDOMNode;this._selectEnabled=selectEnabled;this._rootDOMNode=null;this._selectedDOMNode=null;this._eventSupport=new WebInspector.Object();this._visible=false;this.element.addEventListener("contextmenu",this._contextMenuEventFired.bind(this),true);this._contextMenuCallback=contextMenuCallback;this._setPseudoClassCallback=setPseudoClassCallback;this._createNodeDecorators();}
4781 WebInspector.ElementsTreeOutline.Events={SelectedNodeChanged:"SelectedNodeChanged",ElementsTreeUpdated:"ElementsTreeUpdated"}
4782 WebInspector.ElementsTreeOutline.MappedCharToEntity={"\u00a0":"nbsp","\u2002":"ensp","\u2003":"emsp","\u2009":"thinsp","\u200a":"#8202","\u200b":"#8203","\u200c":"zwnj","\u200d":"zwj","\u200e":"lrm","\u200f":"rlm","\u202a":"#8234","\u202b":"#8235","\u202c":"#8236","\u202d":"#8237","\u202e":"#8238"}
4783 WebInspector.ElementsTreeOutline.prototype={setVisibleWidth:function(width)
4784 {this._visibleWidth=width;if(this._multilineEditing)
4785 this._multilineEditing.setWidth(this._visibleWidth);},_createNodeDecorators:function()
4786 {this._nodeDecorators=[];this._nodeDecorators.push(new WebInspector.ElementsTreeOutline.PseudoStateDecorator());},wireToDomAgent:function()
4787 {this._elementsTreeUpdater=new WebInspector.ElementsTreeUpdater(this);},setVisible:function(visible)
4788 {this._visible=visible;if(!this._visible)
4789 return;this._updateModifiedNodes();if(this._selectedDOMNode)
4790 this._revealAndSelectNode(this._selectedDOMNode,false);},addEventListener:function(eventType,listener,thisObject)
4791 {this._eventSupport.addEventListener(eventType,listener,thisObject);},removeEventListener:function(eventType,listener,thisObject)
4792 {this._eventSupport.removeEventListener(eventType,listener,thisObject);},get rootDOMNode()
4793 {return this._rootDOMNode;},set rootDOMNode(x)
4794 {if(this._rootDOMNode===x)
4795 return;this._rootDOMNode=x;this._isXMLMimeType=x&&x.isXMLNode();this.update();},get isXMLMimeType()
4796 {return this._isXMLMimeType;},selectedDOMNode:function()
4797 {return this._selectedDOMNode;},selectDOMNode:function(node,focus)
4798 {if(this._selectedDOMNode===node){this._revealAndSelectNode(node,!focus);return;}
4799 this._selectedDOMNode=node;this._revealAndSelectNode(node,!focus);if(this._selectedDOMNode===node)
4800 this._selectedNodeChanged();},editing:function()
4801 {var node=this.selectedDOMNode();if(!node)
4802 return false;var treeElement=this.findTreeElement(node);if(!treeElement)
4803 return false;return treeElement._editing||false;},update:function()
4804 {var selectedNode=this.selectedTreeElement?this.selectedTreeElement._node:null;this.removeChildren();if(!this.rootDOMNode)
4805 return;var treeElement;if(this._includeRootDOMNode){treeElement=new WebInspector.ElementsTreeElement(this.rootDOMNode);treeElement.selectable=this._selectEnabled;this.appendChild(treeElement);}else{var node=this.rootDOMNode.firstChild;while(node){treeElement=new WebInspector.ElementsTreeElement(node);treeElement.selectable=this._selectEnabled;this.appendChild(treeElement);node=node.nextSibling;}}
4806 if(selectedNode)
4807 this._revealAndSelectNode(selectedNode,true);},updateSelection:function()
4808 {if(!this.selectedTreeElement)
4809 return;var element=this.treeOutline.selectedTreeElement;element.updateSelection();},updateOpenCloseTags:function(node)
4810 {var treeElement=this.findTreeElement(node);if(treeElement)
4811 treeElement.updateTitle();var children=treeElement.children;var closingTagElement=children[children.length-1];if(closingTagElement&&closingTagElement._elementCloseTag)
4812 closingTagElement.updateTitle();},_selectedNodeChanged:function()
4813 {this._eventSupport.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,this._selectedDOMNode);},_fireElementsTreeUpdated:function(nodes)
4814 {this._eventSupport.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Events.ElementsTreeUpdated,nodes);},findTreeElement:function(node)
4815 {function isAncestorNode(ancestor,node)
4816 {return ancestor.isAncestor(node);}
4817 function parentNode(node)
4818 {return node.parentNode;}
4819 var treeElement=TreeOutline.prototype.findTreeElement.call(this,node,isAncestorNode,parentNode);if(!treeElement&&node.nodeType()===Node.TEXT_NODE){treeElement=TreeOutline.prototype.findTreeElement.call(this,node.parentNode,isAncestorNode,parentNode);}
4820 return treeElement;},createTreeElementFor:function(node)
4821 {var treeElement=this.findTreeElement(node);if(treeElement)
4822 return treeElement;if(!node.parentNode)
4823 return null;treeElement=this.createTreeElementFor(node.parentNode);return treeElement?treeElement._showChild(node):null;},set suppressRevealAndSelect(x)
4824 {if(this._suppressRevealAndSelect===x)
4825 return;this._suppressRevealAndSelect=x;},_revealAndSelectNode:function(node,omitFocus)
4826 {if(this._suppressRevealAndSelect)
4827 return;if(!this._includeRootDOMNode&&node===this.rootDOMNode&&this.rootDOMNode)
4828 node=this.rootDOMNode.firstChild;if(!node)
4829 return;var treeElement=this.createTreeElementFor(node);if(!treeElement)
4830 return;treeElement.revealAndSelect(omitFocus);},_treeElementFromEvent:function(event)
4831 {var scrollContainer=this.element.parentElement;var x=scrollContainer.totalOffsetLeft()+scrollContainer.offsetWidth-36;var y=event.pageY;var elementUnderMouse=this.treeElementFromPoint(x,y);var elementAboveMouse=this.treeElementFromPoint(x,y-2);var element;if(elementUnderMouse===elementAboveMouse)
4832 element=elementUnderMouse;else
4833 element=this.treeElementFromPoint(x,y+2);return element;},_onmousedown:function(event)
4834 {var element=this._treeElementFromEvent(event);if(!element||element.isEventWithinDisclosureTriangle(event))
4835 return;element.select();},_onmousemove:function(event)
4836 {var element=this._treeElementFromEvent(event);if(element&&this._previousHoveredElement===element)
4837 return;if(this._previousHoveredElement){this._previousHoveredElement.hovered=false;delete this._previousHoveredElement;}
4838 if(element){element.hovered=true;this._previousHoveredElement=element;}
4839 WebInspector.domAgent.highlightDOMNode(element&&element._node?element._node.id:0);},_onmouseout:function(event)
4840 {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);if(nodeUnderMouse&&nodeUnderMouse.isDescendant(this.element))
4841 return;if(this._previousHoveredElement){this._previousHoveredElement.hovered=false;delete this._previousHoveredElement;}
4842 WebInspector.domAgent.hideDOMNodeHighlight();},_ondragstart:function(event)
4843 {if(!window.getSelection().isCollapsed)
4844 return false;if(event.target.nodeName==="A")
4845 return false;var treeElement=this._treeElementFromEvent(event);if(!treeElement)
4846 return false;if(!this._isValidDragSourceOrTarget(treeElement))
4847 return false;if(treeElement._node.nodeName()==="BODY"||treeElement._node.nodeName()==="HEAD")
4848 return false;event.dataTransfer.setData("text/plain",treeElement.listItemElement.textContent);event.dataTransfer.effectAllowed="copyMove";this._treeElementBeingDragged=treeElement;WebInspector.domAgent.hideDOMNodeHighlight();return true;},_ondragover:function(event)
4849 {if(!this._treeElementBeingDragged)
4850 return false;var treeElement=this._treeElementFromEvent(event);if(!this._isValidDragSourceOrTarget(treeElement))
4851 return false;var node=treeElement._node;while(node){if(node===this._treeElementBeingDragged._node)
4852 return false;node=node.parentNode;}
4853 treeElement.updateSelection();treeElement.listItemElement.classList.add("elements-drag-over");this._dragOverTreeElement=treeElement;event.preventDefault();event.dataTransfer.dropEffect='move';return false;},_ondragleave:function(event)
4854 {this._clearDragOverTreeElementMarker();event.preventDefault();return false;},_isValidDragSourceOrTarget:function(treeElement)
4855 {if(!treeElement)
4856 return false;var node=treeElement.representedObject;if(!(node instanceof WebInspector.DOMNode))
4857 return false;if(!node.parentNode||node.parentNode.nodeType()!==Node.ELEMENT_NODE)
4858 return false;return true;},_ondrop:function(event)
4859 {event.preventDefault();var treeElement=this._treeElementFromEvent(event);if(treeElement)
4860 this._doMove(treeElement);},_doMove:function(treeElement)
4861 {if(!this._treeElementBeingDragged)
4862 return;var parentNode;var anchorNode;if(treeElement._elementCloseTag){parentNode=treeElement._node;}else{var dragTargetNode=treeElement._node;parentNode=dragTargetNode.parentNode;anchorNode=dragTargetNode;}
4863 var wasExpanded=this._treeElementBeingDragged.expanded;this._treeElementBeingDragged._node.moveTo(parentNode,anchorNode,this._selectNodeAfterEdit.bind(this,wasExpanded));delete this._treeElementBeingDragged;},_ondragend:function(event)
4864 {event.preventDefault();this._clearDragOverTreeElementMarker();delete this._treeElementBeingDragged;},_clearDragOverTreeElementMarker:function()
4865 {if(this._dragOverTreeElement){this._dragOverTreeElement.updateSelection();this._dragOverTreeElement.listItemElement.classList.remove("elements-drag-over");delete this._dragOverTreeElement;}},_onkeydown:function(event)
4866 {var keyboardEvent=(event);var node=(this.selectedDOMNode());console.assert(node);var treeElement=this.getCachedTreeElement(node);if(!treeElement)
4867 return;if(!treeElement._editing&&WebInspector.KeyboardShortcut.hasNoModifiers(keyboardEvent)&&keyboardEvent.keyCode===WebInspector.KeyboardShortcut.Keys.H.code){this._toggleHideShortcut(node);event.consume(true);return;}},_contextMenuEventFired:function(event)
4868 {var treeElement=this._treeElementFromEvent(event);if(!treeElement)
4869 return;var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicableItems(treeElement._node);contextMenu.show();},populateContextMenu:function(contextMenu,event)
4870 {var treeElement=this._treeElementFromEvent(event);if(!treeElement)
4871 return;var isPseudoElement=!!treeElement._node.pseudoType();var isTag=treeElement._node.nodeType()===Node.ELEMENT_NODE&&!isPseudoElement;var textNode=event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");if(textNode&&textNode.classList.contains("bogus"))
4872 textNode=null;var commentNode=event.target.enclosingNodeOrSelfWithClass("webkit-html-comment");contextMenu.appendApplicableItems(event.target);if(textNode){contextMenu.appendSeparator();treeElement._populateTextContextMenu(contextMenu,textNode);}else if(isTag){contextMenu.appendSeparator();treeElement._populateTagContextMenu(contextMenu,event);}else if(commentNode){contextMenu.appendSeparator();treeElement._populateNodeContextMenu(contextMenu,textNode);}else if(isPseudoElement){treeElement._populateScrollIntoView(contextMenu);}},_updateModifiedNodes:function()
4873 {if(this._elementsTreeUpdater)
4874 this._elementsTreeUpdater._updateModifiedNodes();},_populateContextMenu:function(contextMenu,node)
4875 {if(this._contextMenuCallback)
4876 this._contextMenuCallback(contextMenu,node);},handleShortcut:function(event)
4877 {var node=this.selectedDOMNode();var treeElement=this.getCachedTreeElement(node);if(!node||!treeElement)
4878 return;if(event.keyIdentifier==="F2"){this._toggleEditAsHTML(node);event.handled=true;return;}
4879 if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&node.parentNode){if(event.keyIdentifier==="Up"&&node.previousSibling){node.moveTo(node.parentNode,node.previousSibling,this._selectNodeAfterEdit.bind(this,treeElement.expanded));event.handled=true;return;}
4880 if(event.keyIdentifier==="Down"&&node.nextSibling){node.moveTo(node.parentNode,node.nextSibling.nextSibling,this._selectNodeAfterEdit.bind(this,treeElement.expanded));event.handled=true;return;}}},_toggleEditAsHTML:function(node)
4881 {var treeElement=this.getCachedTreeElement(node);if(!treeElement)
4882 return;if(treeElement._editing&&treeElement._htmlEditElement&&WebInspector.isBeingEdited(treeElement._htmlEditElement))
4883 treeElement._editing.commit();else
4884 treeElement._editAsHTML();},_selectNodeAfterEdit:function(wasExpanded,error,nodeId)
4885 {if(error)
4886 return;this._updateModifiedNodes();var newNode=nodeId?WebInspector.domAgent.nodeForId(nodeId):null;if(!newNode)
4887 return;this.selectDOMNode(newNode,true);var newTreeItem=this.findTreeElement(newNode);if(wasExpanded){if(newTreeItem)
4888 newTreeItem.expand();}
4889 return newTreeItem;},_toggleHideShortcut:function(node,userCallback)
4890 {var pseudoType=node.pseudoType();var effectiveNode=pseudoType?node.parentNode:node;if(!effectiveNode)
4891 return;function resolvedNode(object)
4892 {if(!object)
4893 return;function toggleClassAndInjectStyleRule(pseudoType)
4894 {const classNamePrefix="__web-inspector-hide";const classNameSuffix="-shortcut__";const styleTagId="__web-inspector-hide-shortcut-style__";const styleRules=".__web-inspector-hide-shortcut__, .__web-inspector-hide-shortcut__ * { visibility: hidden !important; } .__web-inspector-hidebefore-shortcut__::before { visibility: hidden !important; } .__web-inspector-hideafter-shortcut__::after { visibility: hidden !important; }";var className=classNamePrefix+(pseudoType||"")+classNameSuffix;this.classList.toggle(className);var style=document.head.querySelector("style#"+styleTagId);if(style)
4895 return;style=document.createElement("style");style.id=styleTagId;style.type="text/css";style.textContent=styleRules;document.head.appendChild(style);}
4896 object.callFunction(toggleClassAndInjectStyleRule,[{value:pseudoType}],userCallback);object.release();}
4897 WebInspector.RemoteObject.resolveNode(effectiveNode,"",resolvedNode);},__proto__:TreeOutline.prototype}
4898 WebInspector.ElementsTreeOutline.showShadowDOM=function()
4899 {return WebInspector.settings.showShadowDOM.get()||WebInspector.ElementsTreeOutline["showShadowDOMForTest"];}
4900 WebInspector.ElementsTreeOutline.ElementDecorator=function()
4901 {}
4902 WebInspector.ElementsTreeOutline.ElementDecorator.prototype={decorate:function(node)
4903 {},decorateAncestor:function(node)
4904 {}}
4905 WebInspector.ElementsTreeOutline.PseudoStateDecorator=function()
4906 {WebInspector.ElementsTreeOutline.ElementDecorator.call(this);}
4907 WebInspector.ElementsTreeOutline.PseudoStateDecorator.PropertyName="pseudoState";WebInspector.ElementsTreeOutline.PseudoStateDecorator.prototype={decorate:function(node)
4908 {if(node.nodeType()!==Node.ELEMENT_NODE)
4909 return null;var propertyValue=node.getUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDecorator.PropertyName);if(!propertyValue)
4910 return null;return WebInspector.UIString("Element state: %s",":"+propertyValue.join(", :"));},decorateAncestor:function(node)
4911 {if(node.nodeType()!==Node.ELEMENT_NODE)
4912 return null;var descendantCount=node.descendantUserPropertyCount(WebInspector.ElementsTreeOutline.PseudoStateDecorator.PropertyName);if(!descendantCount)
4913 return null;if(descendantCount===1)
4914 return WebInspector.UIString("%d descendant with forced state",descendantCount);return WebInspector.UIString("%d descendants with forced state",descendantCount);}}
4915 WebInspector.ElementsTreeElement=function(node,elementCloseTag)
4916 {TreeElement.call(this,"",node);this._node=node;this._elementCloseTag=elementCloseTag;this._updateHasChildren();if(this._node.nodeType()==Node.ELEMENT_NODE&&!elementCloseTag)
4917 this._canAddAttributes=true;this._searchQuery=null;this._expandedChildrenLimit=WebInspector.ElementsTreeElement.InitialChildrenLimit;}
4918 WebInspector.ElementsTreeElement.InitialChildrenLimit=500;WebInspector.ElementsTreeElement.ForbiddenClosingTagElements=["area","base","basefont","br","canvas","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source"].keySet();WebInspector.ElementsTreeElement.EditTagBlacklist=["html","head","body"].keySet();WebInspector.ElementsTreeElement.prototype={highlightSearchResults:function(searchQuery)
4919 {if(this._searchQuery!==searchQuery){this._updateSearchHighlight(false);delete this._highlightResult;}
4920 this._searchQuery=searchQuery;this._searchHighlightsVisible=true;this.updateTitle(true);},hideSearchHighlights:function()
4921 {delete this._searchHighlightsVisible;this._updateSearchHighlight(false);},_updateSearchHighlight:function(show)
4922 {if(!this._highlightResult)
4923 return;function updateEntryShow(entry)
4924 {switch(entry.type){case"added":entry.parent.insertBefore(entry.node,entry.nextSibling);break;case"changed":entry.node.textContent=entry.newText;break;}}
4925 function updateEntryHide(entry)
4926 {switch(entry.type){case"added":entry.node.remove();break;case"changed":entry.node.textContent=entry.oldText;break;}}
4927 if(show){for(var i=0,size=this._highlightResult.length;i<size;++i)
4928 updateEntryShow(this._highlightResult[i]);}else{for(var i=(this._highlightResult.length-1);i>=0;--i)
4929 updateEntryHide(this._highlightResult[i]);}},get hovered()
4930 {return this._hovered;},set hovered(x)
4931 {if(this._hovered===x)
4932 return;this._hovered=x;if(this.listItemElement){if(x){this.updateSelection();this.listItemElement.classList.add("hovered");}else{this.listItemElement.classList.remove("hovered");}}},get expandedChildrenLimit()
4933 {return this._expandedChildrenLimit;},set expandedChildrenLimit(x)
4934 {if(this._expandedChildrenLimit===x)
4935 return;this._expandedChildrenLimit=x;if(this.treeOutline&&!this._updateChildrenInProgress)
4936 this._updateChildren(true);},get expandedChildCount()
4937 {var count=this.children.length;if(count&&this.children[count-1]._elementCloseTag)
4938 count--;if(count&&this.children[count-1].expandAllButton)
4939 count--;return count;},_showChild:function(child)
4940 {if(this._elementCloseTag)
4941 return null;var index=this._visibleChildren().indexOf(child);if(index===-1)
4942 return null;if(index>=this.expandedChildrenLimit){this._expandedChildrenLimit=index+1;this._updateChildren(true);}
4943 return this.expandedChildCount>index?this.children[index]:null;},updateSelection:function()
4944 {var listItemElement=this.listItemElement;if(!listItemElement)
4945 return;if(!this._readyToUpdateSelection){if(document.body.offsetWidth>0)
4946 this._readyToUpdateSelection=true;else{return;}}
4947 if(!this.selectionElement){this.selectionElement=document.createElement("div");this.selectionElement.className="selection selected";listItemElement.insertBefore(this.selectionElement,listItemElement.firstChild);}
4948 this.selectionElement.style.height=listItemElement.offsetHeight+"px";},onattach:function()
4949 {if(this._hovered){this.updateSelection();this.listItemElement.classList.add("hovered");}
4950 this.updateTitle();this._preventFollowingLinksOnDoubleClick();this.listItemElement.draggable=true;},_preventFollowingLinksOnDoubleClick:function()
4951 {var links=this.listItemElement.querySelectorAll("li > .webkit-html-tag > .webkit-html-attribute > .webkit-html-external-link, li > .webkit-html-tag > .webkit-html-attribute > .webkit-html-resource-link");if(!links)
4952 return;for(var i=0;i<links.length;++i)
4953 links[i].preventFollowOnDoubleClick=true;},onpopulate:function()
4954 {if(this.children.length||this._showInlineText()||this._elementCloseTag)
4955 return;this.updateChildren();},updateChildren:function(fullRefresh)
4956 {if(this._elementCloseTag)
4957 return;this._node.getChildNodes(this._updateChildren.bind(this,fullRefresh));},insertChildElement:function(child,index,closingTag)
4958 {var newElement=new WebInspector.ElementsTreeElement(child,closingTag);newElement.selectable=this.treeOutline._selectEnabled;this.insertChild(newElement,index);return newElement;},moveChild:function(child,targetIndex)
4959 {var wasSelected=child.selected;this.removeChild(child);this.insertChild(child,targetIndex);if(wasSelected)
4960 child.select();},_updateChildren:function(fullRefresh)
4961 {if(this._updateChildrenInProgress||!this.treeOutline._visible)
4962 return;this._updateChildrenInProgress=true;var selectedNode=this.treeOutline.selectedDOMNode();var originalScrollTop=0;if(fullRefresh){var treeOutlineContainerElement=this.treeOutline.element.parentNode;originalScrollTop=treeOutlineContainerElement.scrollTop;var selectedTreeElement=this.treeOutline.selectedTreeElement;if(selectedTreeElement&&selectedTreeElement.hasAncestor(this))
4963 this.select();this.removeChildren();}
4964 var treeElement=this;var treeChildIndex=0;var elementToSelect;function updateChildrenOfNode()
4965 {var treeOutline=treeElement.treeOutline;var visibleChildren=this._visibleChildren();for(var i=0;i<visibleChildren.length;++i){var child=visibleChildren[i];var currentTreeElement=treeElement.children[treeChildIndex];if(!currentTreeElement||currentTreeElement._node!==child){var existingTreeElement=null;for(var j=(treeChildIndex+1),size=treeElement.expandedChildCount;j<size;++j){if(treeElement.children[j]._node===child){existingTreeElement=treeElement.children[j];break;}}
4966 if(existingTreeElement&&existingTreeElement.parent===treeElement){treeElement.moveChild(existingTreeElement,treeChildIndex);}else{if(treeChildIndex<treeElement.expandedChildrenLimit){var newElement=treeElement.insertChildElement(child,treeChildIndex);if(child===selectedNode)
4967 elementToSelect=newElement;if(treeElement.expandedChildCount>treeElement.expandedChildrenLimit)
4968 treeElement.expandedChildrenLimit++;}}}
4969 ++treeChildIndex;}}
4970 for(var i=(this.children.length-1);i>=0;--i){var currentChild=this.children[i];var currentNode=currentChild._node;if(!currentNode)
4971 continue;var currentParentNode=currentNode.parentNode;if(currentParentNode===this._node)
4972 continue;var selectedTreeElement=this.treeOutline.selectedTreeElement;if(selectedTreeElement&&(selectedTreeElement===currentChild||selectedTreeElement.hasAncestor(currentChild)))
4973 this.select();this.removeChildAtIndex(i);}
4974 updateChildrenOfNode.call(this);this._adjustCollapsedRange();var lastChild=this.children[this.children.length-1];if(this._node.nodeType()==Node.ELEMENT_NODE&&(!lastChild||!lastChild._elementCloseTag))
4975 this.insertChildElement(this._node,this.children.length,true);if(fullRefresh&&elementToSelect){elementToSelect.select();if(treeOutlineContainerElement&&originalScrollTop<=treeOutlineContainerElement.scrollHeight)
4976 treeOutlineContainerElement.scrollTop=originalScrollTop;}
4977 delete this._updateChildrenInProgress;},_adjustCollapsedRange:function()
4978 {var visibleChildren=this._visibleChildren();if(this.expandAllButtonElement&&this.expandAllButtonElement.__treeElement.parent)
4979 this.removeChild(this.expandAllButtonElement.__treeElement);const childNodeCount=visibleChildren.length;for(var i=this.expandedChildCount,limit=Math.min(this.expandedChildrenLimit,childNodeCount);i<limit;++i)
4980 this.insertChildElement(visibleChildren[i],i);const expandedChildCount=this.expandedChildCount;if(childNodeCount>this.expandedChildCount){var targetButtonIndex=expandedChildCount;if(!this.expandAllButtonElement){var button=document.createElement("button");button.className="show-all-nodes";button.value="";var item=new TreeElement(button,null,false);item.selectable=false;item.expandAllButton=true;this.insertChild(item,targetButtonIndex);this.expandAllButtonElement=item.listItemElement.firstChild;this.expandAllButtonElement.__treeElement=item;this.expandAllButtonElement.addEventListener("click",this.handleLoadAllChildren.bind(this),false);}else if(!this.expandAllButtonElement.__treeElement.parent)
4981 this.insertChild(this.expandAllButtonElement.__treeElement,targetButtonIndex);this.expandAllButtonElement.textContent=WebInspector.UIString("Show All Nodes (%d More)",childNodeCount-expandedChildCount);}else if(this.expandAllButtonElement)
4982 delete this.expandAllButtonElement;},handleLoadAllChildren:function()
4983 {this.expandedChildrenLimit=Math.max(this._visibleChildCount(),this.expandedChildrenLimit+WebInspector.ElementsTreeElement.InitialChildrenLimit);},expandRecursively:function()
4984 {function callback()
4985 {TreeElement.prototype.expandRecursively.call(this,Number.MAX_VALUE);}
4986 this._node.getSubtree(-1,callback.bind(this));},onexpand:function()
4987 {if(this._elementCloseTag)
4988 return;this.updateTitle();this.treeOutline.updateSelection();},oncollapse:function()
4989 {if(this._elementCloseTag)
4990 return;this.updateTitle();this.treeOutline.updateSelection();},onreveal:function()
4991 {if(this.listItemElement){var tagSpans=this.listItemElement.getElementsByClassName("webkit-html-tag-name");if(tagSpans.length)
4992 tagSpans[0].scrollIntoViewIfNeeded(true);else
4993 this.listItemElement.scrollIntoViewIfNeeded(true);}},onselect:function(selectedByUser)
4994 {this.treeOutline.suppressRevealAndSelect=true;this.treeOutline.selectDOMNode(this._node,selectedByUser);if(selectedByUser)
4995 WebInspector.domAgent.highlightDOMNode(this._node.id);this.updateSelection();this.treeOutline.suppressRevealAndSelect=false;return true;},ondelete:function()
4996 {var startTagTreeElement=this.treeOutline.findTreeElement(this._node);startTagTreeElement?startTagTreeElement.remove():this.remove();return true;},onenter:function()
4997 {if(this._editing)
4998 return false;this._startEditing();return true;},selectOnMouseDown:function(event)
4999 {TreeElement.prototype.selectOnMouseDown.call(this,event);if(this._editing)
5000 return;if(this.treeOutline._showInElementsPanelEnabled){WebInspector.showPanel("elements");this.treeOutline.selectDOMNode(this._node,true);}
5001 if(event.detail>=2)
5002 event.preventDefault();},ondblclick:function(event)
5003 {if(this._editing||this._elementCloseTag)
5004 return false;if(this._startEditingTarget(event.target))
5005 return false;if(this.hasChildren&&!this.expanded)
5006 this.expand();return false;},_insertInLastAttributePosition:function(tag,node)
5007 {if(tag.getElementsByClassName("webkit-html-attribute").length>0)
5008 tag.insertBefore(node,tag.lastChild);else{var nodeName=tag.textContent.match(/^<(.*?)>$/)[1];tag.textContent='';tag.appendChild(document.createTextNode('<'+nodeName));tag.appendChild(node);tag.appendChild(document.createTextNode('>'));}
5009 this.updateSelection();},_startEditingTarget:function(eventTarget)
5010 {if(this.treeOutline.selectedDOMNode()!=this._node)
5011 return;if(this._node.nodeType()!=Node.ELEMENT_NODE&&this._node.nodeType()!=Node.TEXT_NODE)
5012 return false;var textNode=eventTarget.enclosingNodeOrSelfWithClass("webkit-html-text-node");if(textNode)
5013 return this._startEditingTextNode(textNode);var attribute=eventTarget.enclosingNodeOrSelfWithClass("webkit-html-attribute");if(attribute)
5014 return this._startEditingAttribute(attribute,eventTarget);var tagName=eventTarget.enclosingNodeOrSelfWithClass("webkit-html-tag-name");if(tagName)
5015 return this._startEditingTagName(tagName);var newAttribute=eventTarget.enclosingNodeOrSelfWithClass("add-attribute");if(newAttribute)
5016 return this._addNewAttribute();return false;},_populateTagContextMenu:function(contextMenu,event)
5017 {var treeElement=this._elementCloseTag?this.treeOutline.findTreeElement(this._node):this;contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add attribute":"Add Attribute"),this._addNewAttribute.bind(treeElement));var attribute=event.target.enclosingNodeOrSelfWithClass("webkit-html-attribute");var newAttribute=event.target.enclosingNodeOrSelfWithClass("add-attribute");if(attribute&&!newAttribute)
5018 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Edit attribute":"Edit Attribute"),this._startEditingAttribute.bind(this,attribute,event.target));contextMenu.appendSeparator();if(this.treeOutline._setPseudoClassCallback){var pseudoSubMenu=contextMenu.appendSubMenuItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Force element state":"Force Element State"));this._populateForcedPseudoStateItems(pseudoSubMenu);contextMenu.appendSeparator();}
5019 this._populateNodeContextMenu(contextMenu);this.treeOutline._populateContextMenu(contextMenu,this._node);this._populateScrollIntoView(contextMenu);},_populateScrollIntoView:function(contextMenu)
5020 {contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Scroll into view":"Scroll into View"),this._scrollIntoView.bind(this));},_populateForcedPseudoStateItems:function(subMenu)
5021 {const pseudoClasses=["active","hover","focus","visited"];var node=this._node;var forcedPseudoState=(node?node.getUserProperty("pseudoState"):null)||[];for(var i=0;i<pseudoClasses.length;++i){var pseudoClassForced=forcedPseudoState.indexOf(pseudoClasses[i])>=0;subMenu.appendCheckboxItem(":"+pseudoClasses[i],this.treeOutline._setPseudoClassCallback.bind(null,node.id,pseudoClasses[i],!pseudoClassForced),pseudoClassForced,false);}},_populateTextContextMenu:function(contextMenu,textNode)
5022 {contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Edit text":"Edit Text"),this._startEditingTextNode.bind(this,textNode));this._populateNodeContextMenu(contextMenu);},_populateNodeContextMenu:function(contextMenu)
5023 {var openTagElement=this.treeOutline.getCachedTreeElement(this.representedObject)||this;contextMenu.appendItem(WebInspector.UIString("Edit as HTML"),openTagElement._editAsHTML.bind(openTagElement));contextMenu.appendItem(WebInspector.UIString("Copy as HTML"),this._copyHTML.bind(this));if(this.representedObject.nodeType()===Node.ELEMENT_NODE)
5024 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy CSS path":"Copy CSS Path"),this._copyCSSPath.bind(this));contextMenu.appendItem(WebInspector.UIString("Copy XPath"),this._copyXPath.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Delete node":"Delete Node"),this.remove.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Inspect DOM properties":"Inspect DOM Properties"),this._inspectDOMProperties.bind(this));},_startEditing:function()
5025 {if(this.treeOutline.selectedDOMNode()!==this._node)
5026 return;var listItem=this._listItemNode;if(this._canAddAttributes){var attribute=listItem.getElementsByClassName("webkit-html-attribute")[0];if(attribute)
5027 return this._startEditingAttribute(attribute,attribute.getElementsByClassName("webkit-html-attribute-value")[0]);return this._addNewAttribute();}
5028 if(this._node.nodeType()===Node.TEXT_NODE){var textNode=listItem.getElementsByClassName("webkit-html-text-node")[0];if(textNode)
5029 return this._startEditingTextNode(textNode);return;}},_addNewAttribute:function()
5030 {var container=document.createElement("span");this._buildAttributeDOM(container," ","");var attr=container.firstElementChild;attr.style.marginLeft="2px";attr.style.marginRight="2px";var tag=this.listItemElement.getElementsByClassName("webkit-html-tag")[0];this._insertInLastAttributePosition(tag,attr);attr.scrollIntoViewIfNeeded(true);return this._startEditingAttribute(attr,attr);},_triggerEditAttribute:function(attributeName)
5031 {var attributeElements=this.listItemElement.getElementsByClassName("webkit-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)
5032 continue;if(elem.classList.contains("webkit-html-attribute-value"))
5033 return this._startEditingAttribute(elem.parentNode,elem);}}}},_startEditingAttribute:function(attribute,elementForSelection)
5034 {if(WebInspector.isBeingEdited(attribute))
5035 return true;var attributeNameElement=attribute.getElementsByClassName("webkit-html-attribute-name")[0];if(!attributeNameElement)
5036 return false;var attributeName=attributeNameElement.textContent;var attributeValueElement=attribute.getElementsByClassName("webkit-html-attribute-value")[0];function removeZeroWidthSpaceRecursive(node)
5037 {if(node.nodeType===Node.TEXT_NODE){node.nodeValue=node.nodeValue.replace(/\u200B/g,"");return;}
5038 if(node.nodeType!==Node.ELEMENT_NODE)
5039 return;for(var child=node.firstChild;child;child=child.nextSibling)
5040 removeZeroWidthSpaceRecursive(child);}
5041 var domNode;var listItemElement=attribute.enclosingNodeOrSelfWithNodeName("li");if(attributeName&&attributeValueElement&&listItemElement&&listItemElement.treeElement)
5042 domNode=listItemElement.treeElement.representedObject;var attributeValue=domNode?domNode.getAttribute(attributeName):undefined;if(typeof attributeValue!=="undefined")
5043 attributeValueElement.textContent=attributeValue;removeZeroWidthSpaceRecursive(attribute);var config=new WebInspector.EditingConfig(this._attributeEditingCommitted.bind(this),this._editingCancelled.bind(this),attributeName);function handleKeyDownEvents(event)
5044 {var isMetaOrCtrl=WebInspector.isMac()?event.metaKey&&!event.shiftKey&&!event.ctrlKey&&!event.altKey:event.ctrlKey&&!event.shiftKey&&!event.metaKey&&!event.altKey;if(isEnterKey(event)&&(event.isMetaOrCtrlForTest||!config.multiline||isMetaOrCtrl))
5045 return"commit";else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code||event.keyIdentifier==="U+001B")
5046 return"cancel";else if(event.keyIdentifier==="U+0009")
5047 return"move-"+(event.shiftKey?"backward":"forward");else{WebInspector.handleElementValueModifications(event,attribute);return"";}}
5048 config.customFinishHandler=handleKeyDownEvents.bind(this);this._editing=WebInspector.startEditing(attribute,config);window.getSelection().setBaseAndExtent(elementForSelection,0,elementForSelection,1);return true;},_startEditingTextNode:function(textNodeElement)
5049 {if(WebInspector.isBeingEdited(textNodeElement))
5050 return true;var textNode=this._node;if(textNode.nodeType()===Node.ELEMENT_NODE&&textNode.firstChild)
5051 textNode=textNode.firstChild;var container=textNodeElement.enclosingNodeOrSelfWithClass("webkit-html-text-node");if(container)
5052 container.textContent=textNode.nodeValue();var config=new WebInspector.EditingConfig(this._textNodeEditingCommitted.bind(this,textNode),this._editingCancelled.bind(this));this._editing=WebInspector.startEditing(textNodeElement,config);window.getSelection().setBaseAndExtent(textNodeElement,0,textNodeElement,1);return true;},_startEditingTagName:function(tagNameElement)
5053 {if(!tagNameElement){tagNameElement=this.listItemElement.getElementsByClassName("webkit-html-tag-name")[0];if(!tagNameElement)
5054 return false;}
5055 var tagName=tagNameElement.textContent;if(WebInspector.ElementsTreeElement.EditTagBlacklist[tagName.toLowerCase()])
5056 return false;if(WebInspector.isBeingEdited(tagNameElement))
5057 return true;var closingTagElement=this._distinctClosingTagElement();function keyupListener(event)
5058 {if(closingTagElement)
5059 closingTagElement.textContent="</"+tagNameElement.textContent+">";}
5060 function editingComitted(element,newTagName)
5061 {tagNameElement.removeEventListener('keyup',keyupListener,false);this._tagNameEditingCommitted.apply(this,arguments);}
5062 function editingCancelled()
5063 {tagNameElement.removeEventListener('keyup',keyupListener,false);this._editingCancelled.apply(this,arguments);}
5064 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:function(commitCallback,error,initialValue)
5065 {if(error)
5066 return;if(this._editing)
5067 return;function consume(event)
5068 {if(event.eventPhase===Event.AT_TARGET)
5069 event.consume(true);}
5070 initialValue=this._convertWhitespaceToEntities(initialValue).text;this._htmlEditElement=document.createElement("div");this._htmlEditElement.className="source-code elements-tree-editor";var child=this.listItemElement.firstChild;while(child){child.style.display="none";child=child.nextSibling;}
5071 if(this._childrenListNode)
5072 this._childrenListNode.style.display="none";this.listItemElement.appendChild(this._htmlEditElement);this.treeOutline.childrenListElement.parentElement.addEventListener("mousedown",consume,false);this.updateSelection();function commit(element,newValue)
5073 {commitCallback(initialValue,newValue);dispose.call(this);}
5074 function dispose()
5075 {delete this._editing;delete this.treeOutline._multilineEditing;this.listItemElement.removeChild(this._htmlEditElement);delete this._htmlEditElement;if(this._childrenListNode)
5076 this._childrenListNode.style.removeProperty("display");var child=this.listItemElement.firstChild;while(child){child.style.removeProperty("display");child=child.nextSibling;}
5077 this.treeOutline.childrenListElement.parentElement.removeEventListener("mousedown",consume,false);this.updateSelection();this.treeOutline.element.focus();}
5078 var config=new WebInspector.EditingConfig(commit.bind(this),dispose.bind(this));config.setMultilineOptions(initialValue,{name:"xml",htmlMode:true},"web-inspector-html",WebInspector.settings.domWordWrap.get(),true);this._editing=WebInspector.startEditing(this._htmlEditElement,config);this._editing.setWidth(this.treeOutline._visibleWidth);this.treeOutline._multilineEditing=this._editing;},_attributeEditingCommitted:function(element,newText,oldText,attributeName,moveDirection)
5079 {delete this._editing;var treeOutline=this.treeOutline;function moveToNextAttributeIfNeeded(error)
5080 {if(error)
5081 this._editingCancelled(element,attributeName);if(!moveDirection)
5082 return;treeOutline._updateModifiedNodes();var attributes=this._node.attributes();for(var i=0;i<attributes.length;++i){if(attributes[i].name!==attributeName)
5083 continue;if(moveDirection==="backward"){if(i===0)
5084 this._startEditingTagName();else
5085 this._triggerEditAttribute(attributes[i-1].name);}else{if(i===attributes.length-1)
5086 this._addNewAttribute();else
5087 this._triggerEditAttribute(attributes[i+1].name);}
5088 return;}
5089 if(moveDirection==="backward"){if(newText===" "){if(attributes.length>0)
5090 this._triggerEditAttribute(attributes[attributes.length-1].name);}else{if(attributes.length>1)
5091 this._triggerEditAttribute(attributes[attributes.length-2].name);}}else if(moveDirection==="forward"){if(!/^\s*$/.test(newText))
5092 this._addNewAttribute();else
5093 this._startEditingTagName();}}
5094 if(!attributeName.trim()&&!newText.trim()){element.remove();moveToNextAttributeIfNeeded.call(this);return;}
5095 if(oldText!==newText){this._node.setAttribute(attributeName,newText,moveToNextAttributeIfNeeded.bind(this));return;}
5096 this.updateTitle();moveToNextAttributeIfNeeded.call(this);},_tagNameEditingCommitted:function(element,newText,oldText,tagName,moveDirection)
5097 {delete this._editing;var self=this;function cancel()
5098 {var closingTagElement=self._distinctClosingTagElement();if(closingTagElement)
5099 closingTagElement.textContent="</"+tagName+">";self._editingCancelled(element,tagName);moveToNextAttributeIfNeeded.call(self);}
5100 function moveToNextAttributeIfNeeded()
5101 {if(moveDirection!=="forward"){this._addNewAttribute();return;}
5102 var attributes=this._node.attributes();if(attributes.length>0)
5103 this._triggerEditAttribute(attributes[0].name);else
5104 this._addNewAttribute();}
5105 newText=newText.trim();if(newText===oldText){cancel();return;}
5106 var treeOutline=this.treeOutline;var wasExpanded=this.expanded;function changeTagNameCallback(error,nodeId)
5107 {if(error||!nodeId){cancel();return;}
5108 var newTreeItem=treeOutline._selectNodeAfterEdit(wasExpanded,error,nodeId);moveToNextAttributeIfNeeded.call(newTreeItem);}
5109 this._node.setNodeName(newText,changeTagNameCallback);},_textNodeEditingCommitted:function(textNode,element,newText)
5110 {delete this._editing;function callback()
5111 {this.updateTitle();}
5112 textNode.setNodeValue(newText,callback.bind(this));},_editingCancelled:function(element,context)
5113 {delete this._editing;this.updateTitle();},_distinctClosingTagElement:function()
5114 {if(this.expanded){var closers=this._childrenListNode.querySelectorAll(".close");return closers[closers.length-1];}
5115 var tags=this.listItemElement.getElementsByClassName("webkit-html-tag");return(tags.length===1?null:tags[tags.length-1]);},updateTitle:function(onlySearchQueryChanged)
5116 {if(this._editing)
5117 return;if(onlySearchQueryChanged){if(this._highlightResult)
5118 this._updateSearchHighlight(false);}else{var nodeInfo=this._nodeTitleInfo(WebInspector.linkifyURLAsNode);if(nodeInfo.shadowRoot)
5119 this.listItemElement.classList.add("shadow-root");var highlightElement=document.createElement("span");highlightElement.className="highlight";highlightElement.appendChild(nodeInfo.titleDOM);this.title=highlightElement;this._updateDecorations();delete this._highlightResult;}
5120 delete this.selectionElement;if(this.selected)
5121 this.updateSelection();this._preventFollowingLinksOnDoubleClick();this._highlightSearchResults();},_createDecoratorElement:function()
5122 {var node=this._node;var decoratorMessages=[];var parentDecoratorMessages=[];for(var i=0;i<this.treeOutline._nodeDecorators.length;++i){var decorator=this.treeOutline._nodeDecorators[i];var message=decorator.decorate(node);if(message){decoratorMessages.push(message);continue;}
5123 if(this.expanded||this._elementCloseTag)
5124 continue;message=decorator.decorateAncestor(node);if(message)
5125 parentDecoratorMessages.push(message)}
5126 if(!decoratorMessages.length&&!parentDecoratorMessages.length)
5127 return null;var decoratorElement=document.createElement("div");decoratorElement.classList.add("elements-gutter-decoration");if(!decoratorMessages.length)
5128 decoratorElement.classList.add("elements-has-decorated-children");decoratorElement.title=decoratorMessages.concat(parentDecoratorMessages).join("\n");return decoratorElement;},_updateDecorations:function()
5129 {if(this._decoratorElement)
5130 this._decoratorElement.remove();this._decoratorElement=this._createDecoratorElement();if(this._decoratorElement&&this.listItemElement)
5131 this.listItemElement.insertBefore(this._decoratorElement,this.listItemElement.firstChild);},_buildAttributeDOM:function(parentElement,name,value,forceValue,node,linkify)
5132 {var closingPunctuationRegex=/[\/;:\)\]\}]/g;var highlightIndex=0;var highlightCount;var additionalHighlightOffset=0;var result;function replacer(match,replaceOffset){while(highlightIndex<highlightCount&&result.entityRanges[highlightIndex].offset<replaceOffset){result.entityRanges[highlightIndex].offset+=additionalHighlightOffset;++highlightIndex;}
5133 additionalHighlightOffset+=1;return match+"\u200B";}
5134 function setValueWithEntities(element,value)
5135 {var attrValueElement=element.createChild("span","webkit-html-attribute-value");result=this._convertWhitespaceToEntities(value);highlightCount=result.entityRanges.length;value=result.text.replace(closingPunctuationRegex,replacer);while(highlightIndex<highlightCount){result.entityRanges[highlightIndex].offset+=additionalHighlightOffset;++highlightIndex;}
5136 attrValueElement.textContent=value;WebInspector.highlightRangesWithStyleClass(attrValueElement,result.entityRanges,"webkit-html-entity-value");}
5137 var hasText=(forceValue||value.length>0);var attrSpanElement=parentElement.createChild("span","webkit-html-attribute");var attrNameElement=attrSpanElement.createChild("span","webkit-html-attribute-name");attrNameElement.textContent=name;if(hasText)
5138 attrSpanElement.appendChild(document.createTextNode("=\u200B\""));if(linkify&&(name==="src"||name==="href")){var rewrittenHref=node.resolveURL(value);if(rewrittenHref===null){setValueWithEntities.call(this,attrSpanElement,value);}else{value=value.replace(closingPunctuationRegex,"$&\u200B");if(value.startsWith("data:"))
5139 value=value.trimMiddle(60);attrSpanElement.appendChild(linkify(rewrittenHref,value,"webkit-html-attribute-value",node.nodeName().toLowerCase()==="a"));}}else{setValueWithEntities.call(this,attrSpanElement,value);}
5140 if(hasText)
5141 attrSpanElement.appendChild(document.createTextNode("\""));},_buildPseudoElementDOM:function(parentElement,pseudoElementName)
5142 {var pseudoElement=parentElement.createChild("span","webkit-html-pseudo-element");pseudoElement.textContent="::"+pseudoElementName;parentElement.appendChild(document.createTextNode("\u200B"));},_buildTagDOM:function(parentElement,tagName,isClosingTag,isDistinctTreeElement,linkify)
5143 {var node=this._node;var classes=["webkit-html-tag"];if(isClosingTag&&isDistinctTreeElement)
5144 classes.push("close");var tagElement=parentElement.createChild("span",classes.join(" "));tagElement.appendChild(document.createTextNode("<"));var tagNameElement=tagElement.createChild("span",isClosingTag?"":"webkit-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.appendChild(document.createTextNode(" "));this._buildAttributeDOM(tagElement,attr.name,attr.value,false,node,linkify);}}
5145 tagElement.appendChild(document.createTextNode(">"));parentElement.appendChild(document.createTextNode("\u200B"));},_convertWhitespaceToEntities:function(text)
5146 {var result="";var resultLength=0;var lastIndexAfterEntity=0;var entityRanges=[];var charToEntity=WebInspector.ElementsTreeOutline.MappedCharToEntity;for(var i=0,size=text.length;i<size;++i){var char=text.charAt(i);if(charToEntity[char]){result+=text.substring(lastIndexAfterEntity,i);var entityValue="&"+charToEntity[char]+";";entityRanges.push({offset:result.length,length:entityValue.length});result+=entityValue;lastIndexAfterEntity=i+1;}}
5147 if(result)
5148 result+=text.substring(lastIndexAfterEntity);return{text:result||text,entityRanges:entityRanges};},_nodeTitleInfo:function(linkify)
5149 {var node=this._node;var info={titleDOM:document.createDocumentFragment(),hasChildren:this.hasChildren};switch(node.nodeType()){case Node.ATTRIBUTE_NODE:this._buildAttributeDOM(info.titleDOM,node.name,node.value,true);break;case Node.ELEMENT_NODE:if(node.pseudoType()){this._buildPseudoElementDOM(info.titleDOM,node.pseudoType());info.hasChildren=false;break;}
5150 var tagName=node.nodeNameInCorrectCase();if(this._elementCloseTag){this._buildTagDOM(info.titleDOM,tagName,true,true);info.hasChildren=false;break;}
5151 this._buildTagDOM(info.titleDOM,tagName,false,false,linkify);var showInlineText=this._showInlineText()&&!this.hasChildren;if(!this.expanded&&(!showInlineText&&(this.treeOutline.isXMLMimeType||!WebInspector.ElementsTreeElement.ForbiddenClosingTagElements[tagName]))){if(this.hasChildren){var textNodeElement=info.titleDOM.createChild("span","webkit-html-text-node bogus");textNodeElement.textContent="\u2026";info.titleDOM.appendChild(document.createTextNode("\u200B"));}
5152 this._buildTagDOM(info.titleDOM,tagName,true,false);}
5153 if(showInlineText){var textNodeElement=info.titleDOM.createChild("span","webkit-html-text-node");var result=this._convertWhitespaceToEntities(node.firstChild.nodeValue());textNodeElement.textContent=result.text;WebInspector.highlightRangesWithStyleClass(textNodeElement,result.entityRanges,"webkit-html-entity-value");info.titleDOM.appendChild(document.createTextNode("\u200B"));this._buildTagDOM(info.titleDOM,tagName,true,false);info.hasChildren=false;}
5154 break;case Node.TEXT_NODE:if(node.parentNode&&node.parentNode.nodeName().toLowerCase()==="script"){var newNode=info.titleDOM.createChild("span","webkit-html-text-node webkit-html-js-node");newNode.textContent=node.nodeValue();var javascriptSyntaxHighlighter=new WebInspector.DOMSyntaxHighlighter("text/javascript",true);javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);}else if(node.parentNode&&node.parentNode.nodeName().toLowerCase()==="style"){var newNode=info.titleDOM.createChild("span","webkit-html-text-node webkit-html-css-node");newNode.textContent=node.nodeValue();var cssSyntaxHighlighter=new WebInspector.DOMSyntaxHighlighter("text/css",true);cssSyntaxHighlighter.syntaxHighlightNode(newNode);}else{info.titleDOM.appendChild(document.createTextNode("\""));var textNodeElement=info.titleDOM.createChild("span","webkit-html-text-node");var result=this._convertWhitespaceToEntities(node.nodeValue());textNodeElement.textContent=result.text;WebInspector.highlightRangesWithStyleClass(textNodeElement,result.entityRanges,"webkit-html-entity-value");info.titleDOM.appendChild(document.createTextNode("\""));}
5155 break;case Node.COMMENT_NODE:var commentElement=info.titleDOM.createChild("span","webkit-html-comment");commentElement.appendChild(document.createTextNode("<!--"+node.nodeValue()+"-->"));break;case Node.DOCUMENT_TYPE_NODE:var docTypeElement=info.titleDOM.createChild("span","webkit-html-doctype");docTypeElement.appendChild(document.createTextNode("<!DOCTYPE "+node.nodeName()));if(node.publicId){docTypeElement.appendChild(document.createTextNode(" PUBLIC \""+node.publicId+"\""));if(node.systemId)
5156 docTypeElement.appendChild(document.createTextNode(" \""+node.systemId+"\""));}else if(node.systemId)
5157 docTypeElement.appendChild(document.createTextNode(" SYSTEM \""+node.systemId+"\""));if(node.internalSubset)
5158 docTypeElement.appendChild(document.createTextNode(" ["+node.internalSubset+"]"));docTypeElement.appendChild(document.createTextNode(">"));break;case Node.CDATA_SECTION_NODE:var cdataElement=info.titleDOM.createChild("span","webkit-html-text-node");cdataElement.appendChild(document.createTextNode("<![CDATA["+node.nodeValue()+"]]>"));break;case Node.DOCUMENT_FRAGMENT_NODE:var fragmentElement=info.titleDOM.createChild("span","webkit-html-fragment");var nodeTitle;if(node.isInShadowTree()){var shadowRootType=node.shadowRootType();if(shadowRootType){info.shadowRoot=true;fragmentElement.classList.add("shadow-root");nodeTitle="#shadow-root";if(shadowRootType===WebInspector.DOMNode.ShadowRootTypes.UserAgent)
5159 nodeTitle+=" ("+shadowRootType+")";}}
5160 if(!nodeTitle)
5161 nodeTitle=node.nodeNameInCorrectCase().collapseWhitespace();fragmentElement.textContent=nodeTitle;break;default:info.titleDOM.appendChild(document.createTextNode(node.nodeNameInCorrectCase().collapseWhitespace()));}
5162 return info;},_showInlineText:function()
5163 {if(this._node.templateContent()||(WebInspector.ElementsTreeOutline.showShadowDOM()&&this._node.hasShadowRoots())||this._node.hasPseudoElements())
5164 return false;if(this._node.nodeType()!==Node.ELEMENT_NODE)
5165 return false;if(!this._node.firstChild||this._node.firstChild!==this._node.lastChild||this._node.firstChild.nodeType()!==Node.TEXT_NODE)
5166 return false;var textChild=this._node.firstChild;if(textChild.nodeValue().length<Preferences.maxInlineTextChildLength)
5167 return true;return false;},remove:function()
5168 {if(this._node.pseudoType())
5169 return;var parentElement=this.parent;if(!parentElement)
5170 return;var self=this;function removeNodeCallback(error,removedNodeId)
5171 {if(error)
5172 return;parentElement.removeChild(self);parentElement._adjustCollapsedRange();}
5173 if(!this._node.parentNode||this._node.parentNode.nodeType()===Node.DOCUMENT_NODE)
5174 return;this._node.removeNode(removeNodeCallback);},_editAsHTML:function()
5175 {var node=this._node;if(node.pseudoType())
5176 return;var treeOutline=this.treeOutline;var parentNode=node.parentNode;var index=node.index;var wasExpanded=this.expanded;function selectNode(error,nodeId)
5177 {if(error)
5178 return;treeOutline._updateModifiedNodes();var newNode=parentNode?parentNode.children()[index]||parentNode:null;if(!newNode)
5179 return;treeOutline.selectDOMNode(newNode,true);if(wasExpanded){var newTreeItem=treeOutline.findTreeElement(newNode);if(newTreeItem)
5180 newTreeItem.expand();}}
5181 function commitChange(initialValue,value)
5182 {if(initialValue!==value)
5183 node.setOuterHTML(value,selectNode);else
5184 return;}
5185 node.getOuterHTML(this._startEditingAsHTML.bind(this,commitChange));},_copyHTML:function()
5186 {this._node.copyNode();},_copyCSSPath:function()
5187 {InspectorFrontendHost.copyText(WebInspector.DOMPresentationUtils.cssPath(this._node,true));},_copyXPath:function()
5188 {InspectorFrontendHost.copyText(WebInspector.DOMPresentationUtils.xPath(this._node,true));},_inspectDOMProperties:function()
5189 {WebInspector.RemoteObject.resolveNode(this._node,"console",callback);function callback(nodeObject)
5190 {if(!nodeObject)
5191 return;var message=WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.ConsoleAPI,WebInspector.ConsoleMessage.MessageLevel.Log,"",WebInspector.ConsoleMessage.MessageType.Dir,undefined,undefined,undefined,undefined,[nodeObject]);WebInspector.console.addMessage(message);WebInspector.showConsole();}},_highlightSearchResults:function()
5192 {if(!this._searchQuery||!this._searchHighlightsVisible)
5193 return;if(this._highlightResult){this._updateSearchHighlight(true);return;}
5194 var text=this.listItemElement.textContent;var regexObject=createPlainTextSearchRegex(this._searchQuery,"gi");var offset=0;var match=regexObject.exec(text);var matchRanges=[];while(match){matchRanges.push(new WebInspector.SourceRange(match.index,match[0].length));match=regexObject.exec(text);}
5195 if(!matchRanges.length)
5196 matchRanges.push(new WebInspector.SourceRange(0,text.length));this._highlightResult=[];WebInspector.highlightSearchResults(this.listItemElement,matchRanges,this._highlightResult);},_scrollIntoView:function()
5197 {function scrollIntoViewCallback(object)
5198 {function scrollIntoView()
5199 {this.scrollIntoViewIfNeeded(true);}
5200 if(object)
5201 object.callFunction(scrollIntoView);}
5202 WebInspector.RemoteObject.resolveNode(this._node,"",scrollIntoViewCallback);},_visibleChildren:function()
5203 {var visibleChildren=WebInspector.ElementsTreeOutline.showShadowDOM()?this._node.shadowRoots():[];if(this._node.templateContent())
5204 visibleChildren.push(this._node.templateContent());var pseudoElements=this._node.pseudoElements();if(pseudoElements[WebInspector.DOMNode.PseudoElementNames.Before])
5205 visibleChildren.push(pseudoElements[WebInspector.DOMNode.PseudoElementNames.Before]);if(this._node.childNodeCount())
5206 visibleChildren=visibleChildren.concat(this._node.children());if(pseudoElements[WebInspector.DOMNode.PseudoElementNames.After])
5207 visibleChildren.push(pseudoElements[WebInspector.DOMNode.PseudoElementNames.After]);return visibleChildren;},_visibleChildCount:function()
5208 {var childCount=this._node.childNodeCount();if(this._node.templateContent())
5209 ++childCount;if(WebInspector.ElementsTreeOutline.showShadowDOM())
5210 childCount+=this._node.shadowRoots().length;for(var pseudoType in this._node.pseudoElements())
5211 ++childCount;return childCount;},_updateHasChildren:function()
5212 {this.hasChildren=!this._elementCloseTag&&!this._showInlineText()&&this._visibleChildCount()>0;},__proto__:TreeElement.prototype}
5213 WebInspector.ElementsTreeUpdater=function(treeOutline)
5214 {WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeInserted,this._nodeInserted,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeRemoved,this._nodeRemoved,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified,this._attributesUpdated,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved,this._attributesUpdated,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.CharacterDataModified,this._characterDataModified,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated,this._documentUpdated,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.ChildNodeCountUpdated,this._childNodeCountUpdated,this);this._treeOutline=treeOutline;this._recentlyModifiedNodes=new Map();}
5215 WebInspector.ElementsTreeUpdater.prototype={_nodeModified:function(node,isUpdated,parentNode)
5216 {if(this._treeOutline._visible)
5217 this._updateModifiedNodesSoon();var entry=this._recentlyModifiedNodes.get(node);if(!entry){entry=new WebInspector.ElementsTreeUpdater.UpdateEntry(isUpdated,parentNode);this._recentlyModifiedNodes.put(node,entry);return;}
5218 entry.isUpdated|=isUpdated;if(parentNode)
5219 entry.parent=parentNode;},_documentUpdated:function(event)
5220 {var inspectedRootDocument=event.data;this._reset();if(!inspectedRootDocument)
5221 return;this._treeOutline.rootDOMNode=inspectedRootDocument;},_attributesUpdated:function(event)
5222 {this._nodeModified(event.data.node,true);},_characterDataModified:function(event)
5223 {this._nodeModified(event.data,true);},_nodeInserted:function(event)
5224 {this._nodeModified(event.data,false,event.data.parentNode);},_nodeRemoved:function(event)
5225 {this._nodeModified(event.data.node,false,event.data.parent);},_childNodeCountUpdated:function(event)
5226 {var treeElement=this._treeOutline.findTreeElement(event.data);if(treeElement)
5227 treeElement._updateHasChildren();},_updateModifiedNodesSoon:function()
5228 {if(this._updateModifiedNodesTimeout)
5229 return;this._updateModifiedNodesTimeout=setTimeout(this._updateModifiedNodes.bind(this),50);},_updateModifiedNodes:function()
5230 {if(this._updateModifiedNodesTimeout){clearTimeout(this._updateModifiedNodesTimeout);delete this._updateModifiedNodesTimeout;}
5231 var updatedParentTreeElements=[];var hidePanelWhileUpdating=this._recentlyModifiedNodes.size()>10;if(hidePanelWhileUpdating){var treeOutlineContainerElement=this._treeOutline.element.parentNode;var originalScrollTop=treeOutlineContainerElement?treeOutlineContainerElement.scrollTop:0;this._treeOutline.element.classList.add("hidden");}
5232 var nodes=this._recentlyModifiedNodes.keys();for(var i=0,size=nodes.length;i<size;++i){var node=nodes[i];var entry=this._recentlyModifiedNodes.get(node);var parent=entry.parent;if(parent===this._treeOutline._rootDOMNode){this._treeOutline.update();this._treeOutline.element.classList.remove("hidden");return;}
5233 if(entry.isUpdated){var nodeItem=this._treeOutline.findTreeElement(node);if(nodeItem)
5234 nodeItem.updateTitle();}
5235 var parentNodeItem=parent?this._treeOutline.findTreeElement(parent):null;if(parentNodeItem&&!parentNodeItem.alreadyUpdatedChildren){parentNodeItem.updateChildren();parentNodeItem.alreadyUpdatedChildren=true;updatedParentTreeElements.push(parentNodeItem);}}
5236 for(var i=0;i<updatedParentTreeElements.length;++i)
5237 delete updatedParentTreeElements[i].alreadyUpdatedChildren;if(hidePanelWhileUpdating){this._treeOutline.element.classList.remove("hidden");if(originalScrollTop)
5238 treeOutlineContainerElement.scrollTop=originalScrollTop;this._treeOutline.updateSelection();}
5239 this._recentlyModifiedNodes.clear();this._treeOutline._fireElementsTreeUpdated(nodes);},_reset:function()
5240 {this._treeOutline.rootDOMNode=null;this._treeOutline.selectDOMNode(null,false);WebInspector.domAgent.hideDOMNodeHighlight();this._recentlyModifiedNodes.clear();}}
5241 WebInspector.ElementsTreeUpdater.UpdateEntry=function(isUpdated,parent)
5242 {this.isUpdated=isUpdated;if(parent)
5243 this.parent=parent;}
5244 WebInspector.DOMPresentationUtils={}
5245 WebInspector.DOMPresentationUtils.decorateNodeLabel=function(node,parentElement)
5246 {var title=node.nodeNameInCorrectCase();var nameElement=document.createElement("span");nameElement.textContent=title;parentElement.appendChild(nameElement);var idAttribute=node.getAttribute("id");if(idAttribute){var idElement=document.createElement("span");parentElement.appendChild(idElement);var part="#"+idAttribute;title+=part;idElement.appendChild(document.createTextNode(part));nameElement.className="extra";}
5247 var classAttribute=node.getAttribute("class");if(classAttribute){var classes=classAttribute.split(/\s+/);var foundClasses={};if(classes.length){var classesElement=document.createElement("span");classesElement.className="extra";parentElement.appendChild(classesElement);for(var i=0;i<classes.length;++i){var className=classes[i];if(className&&!(className in foundClasses)){var part="."+className;title+=part;classesElement.appendChild(document.createTextNode(part));foundClasses[className]=true;}}}}
5248 parentElement.title=title;}
5249 WebInspector.DOMPresentationUtils.createSpansForNodeTitle=function(container,nodeTitle)
5250 {var match=nodeTitle.match(/([^#.]+)(#[^.]+)?(\..*)?/);container.createChild("span","webkit-html-tag-name").textContent=match[1];if(match[2])
5251 container.createChild("span","webkit-html-attribute-value").textContent=match[2];if(match[3])
5252 container.createChild("span","webkit-html-attribute-name").textContent=match[3];}
5253 WebInspector.DOMPresentationUtils.linkifyNodeReference=function(node)
5254 {var link=document.createElement("span");link.className="node-link";WebInspector.DOMPresentationUtils.decorateNodeLabel(node,link);link.addEventListener("click",WebInspector.domAgent.inspectElement.bind(WebInspector.domAgent,node.id),false);link.addEventListener("mouseover",WebInspector.domAgent.highlightDOMNode.bind(WebInspector.domAgent,node.id,"",undefined),false);link.addEventListener("mouseout",WebInspector.domAgent.hideDOMNodeHighlight.bind(WebInspector.domAgent),false);return link;}
5255 WebInspector.DOMPresentationUtils.linkifyNodeById=function(nodeId)
5256 {var node=WebInspector.domAgent.nodeForId(nodeId);if(!node)
5257 return document.createTextNode(WebInspector.UIString("<node>"));return WebInspector.DOMPresentationUtils.linkifyNodeReference(node);}
5258 WebInspector.DOMPresentationUtils.buildImagePreviewContents=function(imageURL,showDimensions,userCallback,precomputedDimensions)
5259 {var resource=WebInspector.resourceTreeModel.resourceForURL(imageURL);if(!resource){userCallback();return;}
5260 var imageElement=document.createElement("img");imageElement.addEventListener("load",buildContent,false);imageElement.addEventListener("error",errorCallback,false);resource.populateImageSource(imageElement);function errorCallback()
5261 {userCallback();}
5262 function buildContent()
5263 {var container=document.createElement("table");container.className="image-preview-container";var naturalWidth=precomputedDimensions?precomputedDimensions.naturalWidth:imageElement.naturalWidth;var naturalHeight=precomputedDimensions?precomputedDimensions.naturalHeight:imageElement.naturalHeight;var offsetWidth=precomputedDimensions?precomputedDimensions.offsetWidth:naturalWidth;var offsetHeight=precomputedDimensions?precomputedDimensions.offsetHeight:naturalHeight;var description;if(showDimensions){if(offsetHeight===naturalHeight&&offsetWidth===naturalWidth)
5264 description=WebInspector.UIString("%d \xd7 %d pixels",offsetWidth,offsetHeight);else
5265 description=WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)",offsetWidth,offsetHeight,naturalWidth,naturalHeight);}
5266 container.createChild("tr").createChild("td","image-container").appendChild(imageElement);if(description)
5267 container.createChild("tr").createChild("td").createChild("span","description").textContent=description;userCallback(container);}}
5268 WebInspector.DOMPresentationUtils.appropriateSelectorFor=function(node,justSelector)
5269 {var lowerCaseName=node.localName()||node.nodeName().toLowerCase();if(node.nodeType()!==Node.ELEMENT_NODE)
5270 return lowerCaseName;if(lowerCaseName==="input"&&node.getAttribute("type")&&!node.getAttribute("id")&&!node.getAttribute("class"))
5271 return lowerCaseName+"[type=\""+node.getAttribute("type")+"\"]";return WebInspector.DOMPresentationUtils.cssPath(node,justSelector);}
5272 WebInspector.DOMPresentationUtils.cssPath=function(node,optimized)
5273 {if(node.nodeType()!==Node.ELEMENT_NODE)
5274 return"";var steps=[];var contextNode=node;while(contextNode){var step=WebInspector.DOMPresentationUtils._cssPathValue(contextNode,optimized);if(!step)
5275 break;steps.push(step);if(step.optimized)
5276 break;contextNode=contextNode.parentNode;}
5277 steps.reverse();return steps.join(" > ");}
5278 WebInspector.DOMPresentationUtils._cssPathValue=function(node,optimized)
5279 {if(node.nodeType()!==Node.ELEMENT_NODE)
5280 return null;var id=node.getAttribute("id");if(optimized){if(id)
5281 return new WebInspector.DOMNodePathStep(idSelector(id),true);var nodeNameLower=node.nodeName().toLowerCase();if(nodeNameLower==="body"||nodeNameLower==="head"||nodeNameLower==="html")
5282 return new WebInspector.DOMNodePathStep(node.nodeNameInCorrectCase(),true);}
5283 var nodeName=node.nodeNameInCorrectCase();if(id)
5284 return new WebInspector.DOMNodePathStep(nodeName+idSelector(id),true);var parent=node.parentNode;if(!parent||parent.nodeType()===Node.DOCUMENT_NODE)
5285 return new WebInspector.DOMNodePathStep(nodeName,true);function prefixedElementClassNames(node)
5286 {var classAttribute=node.getAttribute("class");if(!classAttribute)
5287 return[];return classAttribute.split(/\s+/g).filter(Boolean).map(function(name){return"$"+name;});}
5288 function idSelector(id)
5289 {return"#"+escapeIdentifierIfNeeded(id);}
5290 function escapeIdentifierIfNeeded(ident)
5291 {if(isCSSIdentifier(ident))
5292 return ident;var shouldEscapeFirst=/^(?:[0-9]|-[0-9-]?)/.test(ident);var lastIndex=ident.length-1;return ident.replace(/./g,function(c,i){return((shouldEscapeFirst&&i===0)||!isCSSIdentChar(c))?escapeAsciiChar(c,i===lastIndex):c;});}
5293 function escapeAsciiChar(c,isLast)
5294 {return"\\"+toHexByte(c)+(isLast?"":" ");}
5295 function toHexByte(c)
5296 {var hexByte=c.charCodeAt(0).toString(16);if(hexByte.length===1)
5297 hexByte="0"+hexByte;return hexByte;}
5298 function isCSSIdentChar(c)
5299 {if(/[a-zA-Z0-9_-]/.test(c))
5300 return true;return c.charCodeAt(0)>=0xA0;}
5301 function isCSSIdentifier(value)
5302 {return/^-?[a-zA-Z_][a-zA-Z0-9_-]*$/.test(value);}
5303 var prefixedOwnClassNamesArray=prefixedElementClassNames(node);var needsClassNames=false;var needsNthChild=false;var ownIndex=-1;var elementIndex=-1;var siblings=parent.children();for(var i=0;(ownIndex===-1||!needsNthChild)&&i<siblings.length;++i){var sibling=siblings[i];if(sibling.nodeType()!==Node.ELEMENT_NODE)
5304 continue;elementIndex+=1;if(sibling===node){ownIndex=elementIndex;continue;}
5305 if(needsNthChild)
5306 continue;if(sibling.nodeNameInCorrectCase()!==nodeName)
5307 continue;needsClassNames=true;var ownClassNames=prefixedOwnClassNamesArray.keySet();var ownClassNameCount=0;for(var name in ownClassNames)
5308 ++ownClassNameCount;if(ownClassNameCount===0){needsNthChild=true;continue;}
5309 var siblingClassNamesArray=prefixedElementClassNames(sibling);for(var j=0;j<siblingClassNamesArray.length;++j){var siblingClass=siblingClassNamesArray[j];if(!ownClassNames.hasOwnProperty(siblingClass))
5310 continue;delete ownClassNames[siblingClass];if(!--ownClassNameCount){needsNthChild=true;break;}}}
5311 var result=nodeName;if(needsNthChild){result+=":nth-child("+(ownIndex+1)+")";}else if(needsClassNames){for(var prefixedName in prefixedOwnClassNamesArray.keySet())
5312 result+="."+escapeIdentifierIfNeeded(prefixedName.substr(1));}
5313 return new WebInspector.DOMNodePathStep(result,false);}
5314 WebInspector.DOMPresentationUtils.xPath=function(node,optimized)
5315 {if(node.nodeType()===Node.DOCUMENT_NODE)
5316 return"/";var steps=[];var contextNode=node;while(contextNode){var step=WebInspector.DOMPresentationUtils._xPathValue(contextNode,optimized);if(!step)
5317 break;steps.push(step);if(step.optimized)
5318 break;contextNode=contextNode.parentNode;}
5319 steps.reverse();return(steps.length&&steps[0].optimized?"":"/")+steps.join("/");}
5320 WebInspector.DOMPresentationUtils._xPathValue=function(node,optimized)
5321 {var ownValue;var ownIndex=WebInspector.DOMPresentationUtils._xPathIndex(node);if(ownIndex===-1)
5322 return null;switch(node.nodeType()){case Node.ELEMENT_NODE:if(optimized&&node.getAttribute("id"))
5323 return new WebInspector.DOMNodePathStep("//*[@id=\""+node.getAttribute("id")+"\"]",true);ownValue=node.localName();break;case Node.ATTRIBUTE_NODE:ownValue="@"+node.nodeName();break;case Node.TEXT_NODE:case Node.CDATA_SECTION_NODE:ownValue="text()";break;case Node.PROCESSING_INSTRUCTION_NODE:ownValue="processing-instruction()";break;case Node.COMMENT_NODE:ownValue="comment()";break;case Node.DOCUMENT_NODE:ownValue="";break;default:ownValue="";break;}
5324 if(ownIndex>0)
5325 ownValue+="["+ownIndex+"]";return new WebInspector.DOMNodePathStep(ownValue,node.nodeType()===Node.DOCUMENT_NODE);},WebInspector.DOMPresentationUtils._xPathIndex=function(node)
5326 {function areNodesSimilar(left,right)
5327 {if(left===right)
5328 return true;if(left.nodeType()===Node.ELEMENT_NODE&&right.nodeType()===Node.ELEMENT_NODE)
5329 return left.localName()===right.localName();if(left.nodeType()===right.nodeType())
5330 return true;var leftType=left.nodeType()===Node.CDATA_SECTION_NODE?Node.TEXT_NODE:left.nodeType();var rightType=right.nodeType()===Node.CDATA_SECTION_NODE?Node.TEXT_NODE:right.nodeType();return leftType===rightType;}
5331 var siblings=node.parentNode?node.parentNode.children():null;if(!siblings)
5332 return 0;var hasSameNamedElements;for(var i=0;i<siblings.length;++i){if(areNodesSimilar(node,siblings[i])&&siblings[i]!==node){hasSameNamedElements=true;break;}}
5333 if(!hasSameNamedElements)
5334 return 0;var ownIndex=1;for(var i=0;i<siblings.length;++i){if(areNodesSimilar(node,siblings[i])){if(siblings[i]===node)
5335 return ownIndex;++ownIndex;}}
5336 return-1;}
5337 WebInspector.DOMNodePathStep=function(value,optimized)
5338 {this.value=value;this.optimized=optimized||false;}
5339 WebInspector.DOMNodePathStep.prototype={toString:function()
5340 {return this.value;}}
5341 WebInspector.SidebarSectionTreeElement=function(title,representedObject,hasChildren)
5342 {TreeElement.call(this,title.escapeHTML(),representedObject||{},hasChildren);this.expand();}
5343 WebInspector.SidebarSectionTreeElement.prototype={selectable:false,collapse:function()
5344 {},get smallChildren()
5345 {return this._smallChildren;},set smallChildren(x)
5346 {if(this._smallChildren===x)
5347 return;this._smallChildren=x;if(this._smallChildren)
5348 this._childrenListNode.classList.add("small");else
5349 this._childrenListNode.classList.remove("small");},onattach:function()
5350 {this._listItemNode.classList.add("sidebar-tree-section");},onreveal:function()
5351 {if(this.listItemElement)
5352 this.listItemElement.scrollIntoViewIfNeeded(false);},__proto__:TreeElement.prototype}
5353 WebInspector.SidebarTreeElement=function(className,title,subtitle,representedObject,hasChildren)
5354 {TreeElement.call(this,"",representedObject,hasChildren);if(hasChildren){this.disclosureButton=document.createElement("button");this.disclosureButton.className="disclosure-button";}
5355 if(!this.iconElement){this.iconElement=document.createElement("img");this.iconElement.className="icon";}
5356 this.statusElement=document.createElement("div");this.statusElement.className="status";this.titlesElement=document.createElement("div");this.titlesElement.className="titles";this.titleElement=document.createElement("span");this.titleElement.className="title";this.titlesElement.appendChild(this.titleElement);this.subtitleElement=document.createElement("span");this.subtitleElement.className="subtitle";this.titlesElement.appendChild(this.subtitleElement);this.className=className;this.mainTitle=title;this.subtitle=subtitle;}
5357 WebInspector.SidebarTreeElement.prototype={get small()
5358 {return this._small;},set small(x)
5359 {this._small=x;if(this._listItemNode){if(this._small)
5360 this._listItemNode.classList.add("small");else
5361 this._listItemNode.classList.remove("small");}},get mainTitle()
5362 {return this._mainTitle;},set mainTitle(x)
5363 {this._mainTitle=x;this.refreshTitles();},get subtitle()
5364 {return this._subtitle;},set subtitle(x)
5365 {this._subtitle=x;this.refreshTitles();},set wait(x)
5366 {if(x)
5367 this._listItemNode.classList.add("wait");else
5368 this._listItemNode.classList.remove("wait");},refreshTitles:function()
5369 {var mainTitle=this.mainTitle;if(this.titleElement.textContent!==mainTitle)
5370 this.titleElement.textContent=mainTitle;var subtitle=this.subtitle;if(subtitle){if(this.subtitleElement.textContent!==subtitle)
5371 this.subtitleElement.textContent=subtitle;this.titlesElement.classList.remove("no-subtitle");}else{this.subtitleElement.textContent="";this.titlesElement.classList.add("no-subtitle");}},isEventWithinDisclosureTriangle:function(event)
5372 {return event.target===this.disclosureButton;},onattach:function()
5373 {this._listItemNode.classList.add("sidebar-tree-item");if(this.className)
5374 this._listItemNode.classList.add(this.className);if(this.small)
5375 this._listItemNode.classList.add("small");if(this.hasChildren&&this.disclosureButton)
5376 this._listItemNode.appendChild(this.disclosureButton);this._listItemNode.appendChild(this.iconElement);this._listItemNode.appendChild(this.statusElement);this._listItemNode.appendChild(this.titlesElement);},onreveal:function()
5377 {if(this._listItemNode)
5378 this._listItemNode.scrollIntoViewIfNeeded(false);},__proto__:TreeElement.prototype}
5379 WebInspector.Section=function(title,subtitle)
5380 {this.element=document.createElement("div");this.element.className="section";this.element._section=this;this.headerElement=document.createElement("div");this.headerElement.className="header";this.titleElement=document.createElement("div");this.titleElement.className="title";this.subtitleElement=document.createElement("div");this.subtitleElement.className="subtitle";this.headerElement.appendChild(this.subtitleElement);this.headerElement.appendChild(this.titleElement);this.headerElement.addEventListener("click",this.handleClick.bind(this),false);this.element.appendChild(this.headerElement);this.title=title;this.subtitle=subtitle;this._expanded=false;}
5381 WebInspector.Section.prototype={get title()
5382 {return this._title;},set title(x)
5383 {if(this._title===x)
5384 return;this._title=x;if(x instanceof Node){this.titleElement.removeChildren();this.titleElement.appendChild(x);}else
5385 this.titleElement.textContent=x;},get subtitle()
5386 {return this._subtitle;},set subtitle(x)
5387 {if(this._subtitle===x)
5388 return;this._subtitle=x;this.subtitleElement.textContent=x;},get subtitleAsTextForTest()
5389 {var result=this.subtitleElement.textContent;var child=this.subtitleElement.querySelector("[data-uncopyable]");if(child){var linkData=child.getAttribute("data-uncopyable");if(linkData)
5390 result+=linkData;}
5391 return result;},get expanded()
5392 {return this._expanded;},set expanded(x)
5393 {if(x)
5394 this.expand();else
5395 this.collapse();},get populated()
5396 {return this._populated;},set populated(x)
5397 {this._populated=x;if(!x&&this._expanded){this.onpopulate();this._populated=true;}},onpopulate:function()
5398 {},get firstSibling()
5399 {var parent=this.element.parentElement;if(!parent)
5400 return null;var childElement=parent.firstChild;while(childElement){if(childElement._section)
5401 return childElement._section;childElement=childElement.nextSibling;}
5402 return null;},get lastSibling()
5403 {var parent=this.element.parentElement;if(!parent)
5404 return null;var childElement=parent.lastChild;while(childElement){if(childElement._section)
5405 return childElement._section;childElement=childElement.previousSibling;}
5406 return null;},get nextSibling()
5407 {var curElement=this.element;do{curElement=curElement.nextSibling;}while(curElement&&!curElement._section);return curElement?curElement._section:null;},get previousSibling()
5408 {var curElement=this.element;do{curElement=curElement.previousSibling;}while(curElement&&!curElement._section);return curElement?curElement._section:null;},expand:function()
5409 {if(this._expanded)
5410 return;this._expanded=true;this.element.classList.add("expanded");if(!this._populated){this.onpopulate();this._populated=true;}},collapse:function()
5411 {if(!this._expanded)
5412 return;this._expanded=false;this.element.classList.remove("expanded");},toggleExpanded:function()
5413 {this.expanded=!this.expanded;},handleClick:function(event)
5414 {this.toggleExpanded();event.consume();}}
5415 WebInspector.PropertiesSection=function(title,subtitle)
5416 {WebInspector.Section.call(this,title,subtitle);this.headerElement.classList.add("monospace");this.propertiesElement=document.createElement("ol");this.propertiesElement.className="properties properties-tree monospace";this.propertiesTreeOutline=new TreeOutline(this.propertiesElement,true);this.propertiesTreeOutline.setFocusable(false);this.propertiesTreeOutline.section=this;this.element.appendChild(this.propertiesElement);}
5417 WebInspector.PropertiesSection.prototype={__proto__:WebInspector.Section.prototype}
5418 WebInspector.RemoteObject=function(objectId,type,subtype,value,description,preview)
5419 {this._type=type;this._subtype=subtype;if(objectId){this._objectId=objectId;this._description=description;this._hasChildren=true;this._preview=preview;}else{console.assert(type!=="object"||value===null);this._description=description||(value+"");this._hasChildren=false;this.value=value;}}
5420 WebInspector.RemoteObject.fromPrimitiveValue=function(value)
5421 {return new WebInspector.RemoteObject(undefined,typeof value,undefined,value);}
5422 WebInspector.RemoteObject.fromLocalObject=function(value)
5423 {return new WebInspector.LocalJSONObject(value);}
5424 WebInspector.RemoteObject.resolveNode=function(node,objectGroup,callback)
5425 {function mycallback(error,object)
5426 {if(!callback)
5427 return;if(error||!object)
5428 callback(null);else
5429 callback(WebInspector.RemoteObject.fromPayload(object));}
5430 DOMAgent.resolveNode(node.id,objectGroup,mycallback);}
5431 WebInspector.RemoteObject.fromPayload=function(payload)
5432 {console.assert(typeof payload==="object","Remote object payload should only be an object");return new WebInspector.RemoteObject(payload.objectId,payload.type,payload.subtype,payload.value,payload.description,payload.preview);}
5433 WebInspector.RemoteObject.type=function(remoteObject)
5434 {if(remoteObject===null)
5435 return"null";var type=typeof remoteObject;if(type!=="object"&&type!=="function")
5436 return type;return remoteObject.type;}
5437 WebInspector.RemoteObject.prototype={get objectId()
5438 {return this._objectId;},get type()
5439 {return this._type;},get subtype()
5440 {return this._subtype;},get description()
5441 {return this._description;},get hasChildren()
5442 {return this._hasChildren;},get preview()
5443 {return this._preview;},getOwnProperties:function(callback)
5444 {this.doGetProperties(true,false,callback);},getAllProperties:function(accessorPropertiesOnly,callback)
5445 {this.doGetProperties(false,accessorPropertiesOnly,callback);},getProperty:function(propertyPath,callback)
5446 {function remoteFunction(arrayStr)
5447 {var result=this;var properties=JSON.parse(arrayStr);for(var i=0,n=properties.length;i<n;++i)
5448 result=result[properties[i]];return result;}
5449 var args=[{value:JSON.stringify(propertyPath)}];this.callFunction(remoteFunction,args,callback);},doGetProperties:function(ownProperties,accessorPropertiesOnly,callback)
5450 {if(!this._objectId){callback(null,null);return;}
5451 function remoteObjectBinder(error,properties,internalProperties)
5452 {if(error){callback(null,null);return;}
5453 var result=[];for(var i=0;properties&&i<properties.length;++i){var property=properties[i];result.push(new WebInspector.RemoteObjectProperty(property.name,null,property));}
5454 var internalPropertiesResult=null;if(internalProperties){internalPropertiesResult=[];for(var i=0;i<internalProperties.length;i++){var property=internalProperties[i];if(!property.value)
5455 continue;internalPropertiesResult.push(new WebInspector.RemoteObjectProperty(property.name,WebInspector.RemoteObject.fromPayload(property.value)));}}
5456 callback(result,internalPropertiesResult);}
5457 RuntimeAgent.getProperties(this._objectId,ownProperties,accessorPropertiesOnly,remoteObjectBinder);},setPropertyValue:function(name,value,callback)
5458 {if(!this._objectId){callback("Can't set a property of non-object.");return;}
5459 RuntimeAgent.evaluate.invoke({expression:value,doNotPauseOnExceptionsAndMuteConsole:true},evaluatedCallback.bind(this));function evaluatedCallback(error,result,wasThrown)
5460 {if(error||wasThrown){callback(error||result.description);return;}
5461 this.doSetObjectPropertyValue(result,name,callback);if(result.objectId)
5462 RuntimeAgent.releaseObject(result.objectId);}},doSetObjectPropertyValue:function(result,name,callback)
5463 {var setPropertyValueFunction="function(a, b) { this[a] = b; }";if(result.type==="number"&&String(result.value)!==result.description)
5464 setPropertyValueFunction="function(a) { this[a] = "+result.description+"; }";delete result.description;RuntimeAgent.callFunctionOn(this._objectId,setPropertyValueFunction,[{value:name},result],true,undefined,undefined,propertySetCallback.bind(this));function propertySetCallback(error,result,wasThrown)
5465 {if(error||wasThrown){callback(error||result.description);return;}
5466 callback();}},pushNodeToFrontend:function(callback)
5467 {if(this._objectId)
5468 WebInspector.domAgent.pushNodeToFrontend(this._objectId,callback);else
5469 callback(0);},highlightAsDOMNode:function()
5470 {WebInspector.domAgent.highlightDOMNode(undefined,undefined,this._objectId);},hideDOMNodeHighlight:function()
5471 {WebInspector.domAgent.hideDOMNodeHighlight();},callFunction:function(functionDeclaration,args,callback)
5472 {function mycallback(error,result,wasThrown)
5473 {if(!callback)
5474 return;if(error)
5475 callback(null,false);else
5476 callback(WebInspector.RemoteObject.fromPayload(result),wasThrown);}
5477 RuntimeAgent.callFunctionOn(this._objectId,functionDeclaration.toString(),args,true,undefined,undefined,mycallback);},callFunctionJSON:function(functionDeclaration,args,callback)
5478 {function mycallback(error,result,wasThrown)
5479 {callback((error||wasThrown)?null:result.value);}
5480 RuntimeAgent.callFunctionOn(this._objectId,functionDeclaration.toString(),args,true,true,false,mycallback);},release:function()
5481 {if(!this._objectId)
5482 return;RuntimeAgent.releaseObject(this._objectId);},arrayLength:function()
5483 {if(this.subtype!=="array")
5484 return 0;var matches=this._description.match(/\[([0-9]+)\]/);if(!matches)
5485 return 0;return parseInt(matches[1],10);}};WebInspector.RemoteObject.loadFromObject=function(object,flattenProtoChain,callback)
5486 {if(flattenProtoChain)
5487 object.getAllProperties(false,callback);else
5488 WebInspector.RemoteObject.loadFromObjectPerProto(object,callback);};WebInspector.RemoteObject.loadFromObjectPerProto=function(object,callback)
5489 {var savedOwnProperties;var savedAccessorProperties;var savedInternalProperties;var resultCounter=2;function processCallback()
5490 {if(--resultCounter)
5491 return;if(savedOwnProperties&&savedAccessorProperties){var combinedList=savedAccessorProperties.slice(0);for(var i=0;i<savedOwnProperties.length;i++){var property=savedOwnProperties[i];if(!property.isAccessorProperty())
5492 combinedList.push(property);}
5493 return callback(combinedList,savedInternalProperties?savedInternalProperties:null);}else{callback(null,null);}}
5494 function allAccessorPropertiesCallback(properties,internalProperties)
5495 {savedAccessorProperties=properties;processCallback();}
5496 function ownPropertiesCallback(properties,internalProperties)
5497 {savedOwnProperties=properties;savedInternalProperties=internalProperties;processCallback();}
5498 object.getAllProperties(true,allAccessorPropertiesCallback);object.getOwnProperties(ownPropertiesCallback);};WebInspector.ScopeRemoteObject=function(objectId,scopeRef,type,subtype,value,description,preview)
5499 {WebInspector.RemoteObject.call(this,objectId,type,subtype,value,description,preview);this._scopeRef=scopeRef;this._savedScopeProperties=undefined;};WebInspector.ScopeRemoteObject.fromPayload=function(payload,scopeRef)
5500 {if(scopeRef)
5501 return new WebInspector.ScopeRemoteObject(payload.objectId,scopeRef,payload.type,payload.subtype,payload.value,payload.description,payload.preview);else
5502 return new WebInspector.RemoteObject(payload.objectId,payload.type,payload.subtype,payload.value,payload.description,payload.preview);}
5503 WebInspector.ScopeRemoteObject.prototype={doGetProperties:function(ownProperties,accessorPropertiesOnly,callback)
5504 {if(accessorPropertiesOnly){callback([],[]);return;}
5505 if(this._savedScopeProperties){callback(this._savedScopeProperties.slice(),[]);return;}
5506 function wrappedCallback(properties,internalProperties)
5507 {if(this._scopeRef&&properties instanceof Array)
5508 this._savedScopeProperties=properties.slice();callback(properties,internalProperties);}
5509 WebInspector.RemoteObject.prototype.doGetProperties.call(this,ownProperties,accessorPropertiesOnly,wrappedCallback.bind(this));},doSetObjectPropertyValue:function(result,name,callback)
5510 {var newValue;switch(result.type){case"undefined":newValue={};break;case"object":case"function":newValue={objectId:result.objectId};break;default:newValue={value:result.value};}
5511 DebuggerAgent.setVariableValue(this._scopeRef.number,name,newValue,this._scopeRef.callFrameId,this._scopeRef.functionId,setVariableValueCallback.bind(this));function setVariableValueCallback(error)
5512 {if(error){callback(error);return;}
5513 if(this._savedScopeProperties){for(var i=0;i<this._savedScopeProperties.length;i++){if(this._savedScopeProperties[i].name===name)
5514 this._savedScopeProperties[i].value=WebInspector.RemoteObject.fromPayload(result);}}
5515 callback();}},__proto__:WebInspector.RemoteObject.prototype};WebInspector.ScopeRef=function(number,callFrameId,functionId)
5516 {this.number=number;this.callFrameId=callFrameId;this.functionId=functionId;}
5517 WebInspector.RemoteObjectProperty=function(name,value,descriptor)
5518 {this.name=name;this.enumerable=descriptor?!!descriptor.enumerable:true;this.writable=descriptor?!!descriptor.writable:true;if(value===null&&descriptor){if(descriptor.value)
5519 this.value=WebInspector.RemoteObject.fromPayload(descriptor.value)
5520 if(descriptor.get&&descriptor.get.type!=="undefined")
5521 this.getter=WebInspector.RemoteObject.fromPayload(descriptor.get);if(descriptor.set&&descriptor.set.type!=="undefined")
5522 this.setter=WebInspector.RemoteObject.fromPayload(descriptor.set);}else{this.value=value;}
5523 if(descriptor){this.isOwn=descriptor.isOwn;this.wasThrown=!!descriptor.wasThrown;}}
5524 WebInspector.RemoteObjectProperty.prototype={isAccessorProperty:function()
5525 {return!!(this.getter||this.setter);}};WebInspector.RemoteObjectProperty.fromPrimitiveValue=function(name,value)
5526 {return new WebInspector.RemoteObjectProperty(name,WebInspector.RemoteObject.fromPrimitiveValue(value));}
5527 WebInspector.RemoteObjectProperty.fromScopeValue=function(name,value)
5528 {var result=new WebInspector.RemoteObjectProperty(name,value);result.writable=false;return result;}
5529 WebInspector.LocalJSONObject=function(value)
5530 {this._value=value;}
5531 WebInspector.LocalJSONObject.prototype={get description()
5532 {if(this._cachedDescription)
5533 return this._cachedDescription;function formatArrayItem(property)
5534 {return property.value.description;}
5535 function formatObjectItem(property)
5536 {return property.name+":"+property.value.description;}
5537 if(this.type==="object"){switch(this.subtype){case"array":this._cachedDescription=this._concatenate("[","]",formatArrayItem);break;case"date":this._cachedDescription=""+this._value;break;case"null":this._cachedDescription="null";break;default:this._cachedDescription=this._concatenate("{","}",formatObjectItem);}}else
5538 this._cachedDescription=String(this._value);return this._cachedDescription;},_concatenate:function(prefix,suffix,formatProperty)
5539 {const previewChars=100;var buffer=prefix;var children=this._children();for(var i=0;i<children.length;++i){var itemDescription=formatProperty(children[i]);if(buffer.length+itemDescription.length>previewChars){buffer+=",\u2026";break;}
5540 if(i)
5541 buffer+=", ";buffer+=itemDescription;}
5542 buffer+=suffix;return buffer;},get type()
5543 {return typeof this._value;},get subtype()
5544 {if(this._value===null)
5545 return"null";if(this._value instanceof Array)
5546 return"array";if(this._value instanceof Date)
5547 return"date";return undefined;},get hasChildren()
5548 {if((typeof this._value!=="object")||(this._value===null))
5549 return false;return!!Object.keys((this._value)).length;},getOwnProperties:function(callback)
5550 {callback(this._children());},getAllProperties:function(accessorPropertiesOnly,callback)
5551 {if(accessorPropertiesOnly)
5552 callback([]);else
5553 callback(this._children());},_children:function()
5554 {if(!this.hasChildren)
5555 return[];var value=(this._value);function buildProperty(propName)
5556 {return new WebInspector.RemoteObjectProperty(propName,new WebInspector.LocalJSONObject(this._value[propName]));}
5557 if(!this._cachedChildren)
5558 this._cachedChildren=Object.keys(value).map(buildProperty.bind(this));return this._cachedChildren;},isError:function()
5559 {return false;},arrayLength:function()
5560 {return this._value instanceof Array?this._value.length:0;},callFunction:function(functionDeclaration,args,callback)
5561 {var target=(this._value);var rawArgs=args?args.map(function(arg){return arg.value;}):[];var result;var wasThrown=false;try{result=functionDeclaration.apply(target,rawArgs);}catch(e){wasThrown=true;}
5562 if(!callback)
5563 return;callback(WebInspector.RemoteObject.fromLocalObject(result),wasThrown);},callFunctionJSON:function(functionDeclaration,args,callback)
5564 {var target=(this._value);var rawArgs=args?args.map(function(arg){return arg.value;}):[];var result;try{result=functionDeclaration.apply(target,rawArgs);}catch(e){result=null;}
5565 callback(result);},__proto__:WebInspector.RemoteObject.prototype}
5566 WebInspector.ObjectPropertiesSection=function(object,title,subtitle,emptyPlaceholder,ignoreHasOwnProperty,extraProperties,treeElementConstructor)
5567 {this.emptyPlaceholder=(emptyPlaceholder||WebInspector.UIString("No Properties"));this.object=object;this.ignoreHasOwnProperty=ignoreHasOwnProperty;this.extraProperties=extraProperties;this.treeElementConstructor=treeElementConstructor||WebInspector.ObjectPropertyTreeElement;this.editable=true;this.skipProto=false;WebInspector.PropertiesSection.call(this,title||"",subtitle);}
5568 WebInspector.ObjectPropertiesSection._arrayLoadThreshold=100;WebInspector.ObjectPropertiesSection.prototype={enableContextMenu:function()
5569 {this.element.addEventListener("contextmenu",this._contextMenuEventFired.bind(this),false);},_contextMenuEventFired:function(event)
5570 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicableItems(this.object);contextMenu.show();},onpopulate:function()
5571 {this.update();},update:function()
5572 {if(this.object.arrayLength()>WebInspector.ObjectPropertiesSection._arrayLoadThreshold){this.propertiesTreeOutline.removeChildren();WebInspector.ArrayGroupingTreeElement._populateArray(this.propertiesTreeOutline,this.object,0,this.object.arrayLength()-1);return;}
5573 function callback(properties,internalProperties)
5574 {if(!properties)
5575 return;this.updateProperties(properties,internalProperties);}
5576 WebInspector.RemoteObject.loadFromObject(this.object,!!this.ignoreHasOwnProperty,callback.bind(this));},updateProperties:function(properties,internalProperties,rootTreeElementConstructor,rootPropertyComparer)
5577 {if(!rootTreeElementConstructor)
5578 rootTreeElementConstructor=this.treeElementConstructor;if(!rootPropertyComparer)
5579 rootPropertyComparer=WebInspector.ObjectPropertiesSection.CompareProperties;if(this.extraProperties){for(var i=0;i<this.extraProperties.length;++i)
5580 properties.push(this.extraProperties[i]);}
5581 this.propertiesTreeOutline.removeChildren();WebInspector.ObjectPropertyTreeElement.populateWithProperties(this.propertiesTreeOutline,properties,internalProperties,rootTreeElementConstructor,rootPropertyComparer,this.skipProto,this.object);this.propertiesForTest=properties;if(!this.propertiesTreeOutline.children.length){var title=document.createElement("div");title.className="info";title.textContent=this.emptyPlaceholder;var infoElement=new TreeElement(title,null,false);this.propertiesTreeOutline.appendChild(infoElement);}},__proto__:WebInspector.PropertiesSection.prototype}
5582 WebInspector.ObjectPropertiesSection.CompareProperties=function(propertyA,propertyB)
5583 {var a=propertyA.name;var b=propertyB.name;if(a==="__proto__")
5584 return 1;if(b==="__proto__")
5585 return-1;return String.naturalOrderComparator(a,b);}
5586 WebInspector.ObjectPropertyTreeElement=function(property)
5587 {this.property=property;TreeElement.call(this,"",null,false);this.toggleOnClick=true;this.selectable=false;}
5588 WebInspector.ObjectPropertyTreeElement.prototype={onpopulate:function()
5589 {var propertyValue=(this.property.value);console.assert(propertyValue);WebInspector.ObjectPropertyTreeElement.populate(this,propertyValue);},ondblclick:function(event)
5590 {if(this.property.writable||this.property.setter)
5591 this.startEditing(event);return false;},onattach:function()
5592 {this.update();},update:function()
5593 {this.nameElement=document.createElement("span");this.nameElement.className="name";var name=this.property.name;if(/^\s|\s$|^$|\n/.test(name))
5594 name="\""+name.replace(/\n/g,"\u21B5")+"\"";this.nameElement.textContent=name;if(!this.property.enumerable)
5595 this.nameElement.classList.add("dimmed");if(this.property.isAccessorProperty())
5596 this.nameElement.classList.add("properties-accessor-property-name");var separatorElement=document.createElement("span");separatorElement.className="separator";separatorElement.textContent=": ";if(this.property.value){this.valueElement=document.createElement("span");this.valueElement.className="value";var description=this.property.value.description;if(this.property.wasThrown){this.valueElement.textContent="[Exception: "+description+"]";}else if(this.property.value.type==="string"&&typeof description==="string"){this.valueElement.textContent="\""+description.replace(/\n/g,"\u21B5")+"\"";this.valueElement._originalTextContent="\""+description+"\"";}else if(this.property.value.type==="function"&&typeof description==="string"){this.valueElement.textContent=/.*/.exec(description)[0].replace(/ +$/g,"");this.valueElement._originalTextContent=description;}else if(this.property.value.type!=="object"||this.property.value.subtype!=="node"){this.valueElement.textContent=description;}
5597 if(this.property.wasThrown)
5598 this.valueElement.classList.add("error");if(this.property.value.subtype)
5599 this.valueElement.classList.add("console-formatted-"+this.property.value.subtype);else if(this.property.value.type)
5600 this.valueElement.classList.add("console-formatted-"+this.property.value.type);this.valueElement.addEventListener("contextmenu",this._contextMenuFired.bind(this,this.property.value),false);if(this.property.value.type==="object"&&this.property.value.subtype==="node"&&this.property.value.description){WebInspector.DOMPresentationUtils.createSpansForNodeTitle(this.valueElement,this.property.value.description);this.valueElement.addEventListener("mousemove",this._mouseMove.bind(this,this.property.value),false);this.valueElement.addEventListener("mouseout",this._mouseOut.bind(this,this.property.value),false);}else{this.valueElement.title=description||"";}
5601 this.listItemElement.removeChildren();this.hasChildren=this.property.value.hasChildren&&!this.property.wasThrown;}else{if(this.property.getter){this.valueElement=WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan(this.property.parentObject,[this.property.name],this._onInvokeGetterClick.bind(this));}else{this.valueElement=document.createElement("span");this.valueElement.className="console-formatted-undefined";this.valueElement.textContent=WebInspector.UIString("<unreadable>");this.valueElement.title=WebInspector.UIString("No property getter");}}
5602 this.listItemElement.appendChild(this.nameElement);this.listItemElement.appendChild(separatorElement);this.listItemElement.appendChild(this.valueElement);},_contextMenuFired:function(value,event)
5603 {var contextMenu=new WebInspector.ContextMenu(event);this.populateContextMenu(contextMenu);contextMenu.appendApplicableItems(value);contextMenu.show();},populateContextMenu:function(contextMenu)
5604 {},_mouseMove:function(event)
5605 {this.property.value.highlightAsDOMNode();},_mouseOut:function(event)
5606 {this.property.value.hideDOMNodeHighlight();},updateSiblings:function()
5607 {if(this.parent.root)
5608 this.treeOutline.section.update();else
5609 this.parent.shouldRefreshChildren=true;},renderPromptAsBlock:function()
5610 {return false;},elementAndValueToEdit:function(event)
5611 {return[this.valueElement,(typeof this.valueElement._originalTextContent==="string")?this.valueElement._originalTextContent:undefined];},startEditing:function(event)
5612 {var elementAndValueToEdit=this.elementAndValueToEdit(event);var elementToEdit=elementAndValueToEdit[0];var valueToEdit=elementAndValueToEdit[1];if(WebInspector.isBeingEdited(elementToEdit)||!this.treeOutline.section.editable||this._readOnly)
5613 return;if(typeof valueToEdit!=="undefined")
5614 elementToEdit.textContent=valueToEdit;var context={expanded:this.expanded,elementToEdit:elementToEdit,previousContent:elementToEdit.textContent};this.hasChildren=false;this.listItemElement.classList.add("editing-sub-part");this._prompt=new WebInspector.ObjectPropertyPrompt(this.editingCommitted.bind(this,null,elementToEdit.textContent,context.previousContent,context),this.editingCancelled.bind(this,null,context),this.renderPromptAsBlock());function blurListener()
5615 {this.editingCommitted(null,elementToEdit.textContent,context.previousContent,context);}
5616 var proxyElement=this._prompt.attachAndStartEditing(elementToEdit,blurListener.bind(this));window.getSelection().setBaseAndExtent(elementToEdit,0,elementToEdit,1);proxyElement.addEventListener("keydown",this._promptKeyDown.bind(this,context),false);},isEditing:function()
5617 {return!!this._prompt;},editingEnded:function(context)
5618 {this._prompt.detach();delete this._prompt;this.listItemElement.scrollLeft=0;this.listItemElement.classList.remove("editing-sub-part");if(context.expanded)
5619 this.expand();},editingCancelled:function(element,context)
5620 {this.editingEnded(context);this.update();},editingCommitted:function(element,userInput,previousContent,context)
5621 {if(userInput===previousContent){this.editingCancelled(element,context);return;}
5622 this.editingEnded(context);this.applyExpression(userInput,true);},_promptKeyDown:function(context,event)
5623 {if(isEnterKey(event)){event.consume(true);this.editingCommitted(null,context.elementToEdit.textContent,context.previousContent,context);return;}
5624 if(event.keyIdentifier==="U+001B"){event.consume();this.editingCancelled(null,context);return;}},applyExpression:function(expression,updateInterface)
5625 {expression=expression.trim();var expressionLength=expression.length;function callback(error)
5626 {if(!updateInterface)
5627 return;if(error)
5628 this.update();if(!expressionLength){this.parent.removeChild(this);}else{this.updateSiblings();}};this.property.parentObject.setPropertyValue(this.property.name,expression.trim(),callback.bind(this));},propertyPath:function()
5629 {if("_cachedPropertyPath"in this)
5630 return this._cachedPropertyPath;var current=this;var result;do{if(current.property){if(result)
5631 result=current.property.name+"."+result;else
5632 result=current.property.name;}
5633 current=current.parent;}while(current&&!current.root);this._cachedPropertyPath=result;return result;},_onInvokeGetterClick:function(result,wasThrown)
5634 {if(!result)
5635 return;this.property.value=result;this.property.wasThrown=wasThrown;this.update();this.shouldRefreshChildren=true;},__proto__:TreeElement.prototype}
5636 WebInspector.ObjectPropertyTreeElement.populate=function(treeElement,value){if(treeElement.children.length&&!treeElement.shouldRefreshChildren)
5637 return;if(value.arrayLength()>WebInspector.ObjectPropertiesSection._arrayLoadThreshold){treeElement.removeChildren();WebInspector.ArrayGroupingTreeElement._populateArray(treeElement,value,0,value.arrayLength()-1);return;}
5638 function callback(properties,internalProperties)
5639 {treeElement.removeChildren();if(!properties)
5640 return;if(!internalProperties)
5641 internalProperties=[];WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElement,properties,internalProperties,treeElement.treeOutline.section.treeElementConstructor,WebInspector.ObjectPropertiesSection.CompareProperties,treeElement.treeOutline.section.skipProto,value);}
5642 WebInspector.RemoteObject.loadFromObjectPerProto(value,callback);}
5643 WebInspector.ObjectPropertyTreeElement.populateWithProperties=function(treeElement,properties,internalProperties,treeElementConstructor,comparator,skipProto,value){properties.sort(comparator);for(var i=0;i<properties.length;++i){var property=properties[i];if(skipProto&&property.name==="__proto__")
5644 continue;if(property.isAccessorProperty()){if(property.name!=="__proto__"&&property.getter){property.parentObject=value;treeElement.appendChild(new treeElementConstructor(property));}
5645 if(property.isOwn){if(property.getter){var getterProperty=new WebInspector.RemoteObjectProperty("get "+property.name,property.getter);getterProperty.parentObject=value;treeElement.appendChild(new treeElementConstructor(getterProperty));}
5646 if(property.setter){var setterProperty=new WebInspector.RemoteObjectProperty("set "+property.name,property.setter);setterProperty.parentObject=value;treeElement.appendChild(new treeElementConstructor(setterProperty));}}}else{property.parentObject=value;treeElement.appendChild(new treeElementConstructor(property));}}
5647 if(value&&value.type==="function"){var hasTargetFunction=false;if(internalProperties){for(var i=0;i<internalProperties.length;i++){if(internalProperties[i].name=="[[TargetFunction]]"){hasTargetFunction=true;break;}}}
5648 if(!hasTargetFunction)
5649 treeElement.appendChild(new WebInspector.FunctionScopeMainTreeElement(value));}
5650 if(internalProperties){for(var i=0;i<internalProperties.length;i++){internalProperties[i].parentObject=value;treeElement.appendChild(new treeElementConstructor(internalProperties[i]));}}}
5651 WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan=function(object,propertyPath,callback)
5652 {var rootElement=document.createElement("span");var element=rootElement.createChild("span","properties-calculate-value-button");element.textContent=WebInspector.UIString("(...)");element.title=WebInspector.UIString("Invoke property getter");element.addEventListener("click",onInvokeGetterClick,false);function onInvokeGetterClick(event)
5653 {event.consume();object.getProperty(propertyPath,callback);}
5654 return rootElement;}
5655 WebInspector.FunctionScopeMainTreeElement=function(remoteObject)
5656 {TreeElement.call(this,"<function scope>",null,false);this.toggleOnClick=true;this.selectable=false;this._remoteObject=remoteObject;this.hasChildren=true;}
5657 WebInspector.FunctionScopeMainTreeElement.prototype={onpopulate:function()
5658 {if(this.children.length&&!this.shouldRefreshChildren)
5659 return;function didGetDetails(error,response)
5660 {if(error){console.error(error);return;}
5661 this.removeChildren();var scopeChain=response.scopeChain;if(!scopeChain)
5662 return;for(var i=0;i<scopeChain.length;++i){var scope=scopeChain[i];var title=null;var isTrueObject;switch(scope.type){case DebuggerAgent.ScopeType.Local:title=WebInspector.UIString("Local");isTrueObject=false;break;case DebuggerAgent.ScopeType.Closure:title=WebInspector.UIString("Closure");isTrueObject=false;break;case DebuggerAgent.ScopeType.Catch:title=WebInspector.UIString("Catch");isTrueObject=false;break;case DebuggerAgent.ScopeType.With:title=WebInspector.UIString("With Block");isTrueObject=true;break;case DebuggerAgent.ScopeType.Global:title=WebInspector.UIString("Global");isTrueObject=true;break;default:console.error("Unknown scope type: "+scope.type);continue;}
5663 var scopeRef=isTrueObject?undefined:new WebInspector.ScopeRef(i,undefined,this._remoteObject.objectId);var remoteObject=WebInspector.ScopeRemoteObject.fromPayload(scope.object,scopeRef);if(isTrueObject){var property=WebInspector.RemoteObjectProperty.fromScopeValue(title,remoteObject);property.parentObject=null;this.appendChild(new this.treeOutline.section.treeElementConstructor(property));}else{var scopeTreeElement=new WebInspector.ScopeTreeElement(title,null,remoteObject);this.appendChild(scopeTreeElement);}}}
5664 DebuggerAgent.getFunctionDetails(this._remoteObject.objectId,didGetDetails.bind(this));},__proto__:TreeElement.prototype}
5665 WebInspector.ScopeTreeElement=function(title,subtitle,remoteObject)
5666 {TreeElement.call(this,title,null,false);this.toggleOnClick=true;this.selectable=false;this._remoteObject=remoteObject;this.hasChildren=true;}
5667 WebInspector.ScopeTreeElement.prototype={onpopulate:function()
5668 {WebInspector.ObjectPropertyTreeElement.populate(this,this._remoteObject);},__proto__:TreeElement.prototype}
5669 WebInspector.ArrayGroupingTreeElement=function(object,fromIndex,toIndex,propertyCount)
5670 {TreeElement.call(this,String.sprintf("[%d \u2026 %d]",fromIndex,toIndex),undefined,true);this._fromIndex=fromIndex;this._toIndex=toIndex;this._object=object;this._readOnly=true;this._propertyCount=propertyCount;this._populated=false;}
5671 WebInspector.ArrayGroupingTreeElement._bucketThreshold=100;WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold=250000;WebInspector.ArrayGroupingTreeElement._populateArray=function(treeElement,object,fromIndex,toIndex)
5672 {WebInspector.ArrayGroupingTreeElement._populateRanges(treeElement,object,fromIndex,toIndex,true);}
5673 WebInspector.ArrayGroupingTreeElement._populateRanges=function(treeElement,object,fromIndex,toIndex,topLevel)
5674 {object.callFunctionJSON(packRanges,[{value:fromIndex},{value:toIndex},{value:WebInspector.ArrayGroupingTreeElement._bucketThreshold},{value:WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold}],callback.bind(this));function packRanges(fromIndex,toIndex,bucketThreshold,sparseIterationThreshold)
5675 {var ownPropertyNames=null;function doLoop(iterationCallback)
5676 {if(toIndex-fromIndex<sparseIterationThreshold){for(var i=fromIndex;i<=toIndex;++i){if(i in this)
5677 iterationCallback(i);}}else{ownPropertyNames=ownPropertyNames||Object.getOwnPropertyNames(this);for(var i=0;i<ownPropertyNames.length;++i){var name=ownPropertyNames[i];var index=name>>>0;if(String(index)===name&&fromIndex<=index&&index<=toIndex)
5678 iterationCallback(index);}}}
5679 var count=0;function countIterationCallback()
5680 {++count;}
5681 doLoop.call(this,countIterationCallback);var bucketSize=count;if(count<=bucketThreshold)
5682 bucketSize=count;else
5683 bucketSize=Math.pow(bucketThreshold,Math.ceil(Math.log(count)/Math.log(bucketThreshold))-1);var ranges=[];count=0;var groupStart=-1;var groupEnd=0;function loopIterationCallback(i)
5684 {if(groupStart===-1)
5685 groupStart=i;groupEnd=i;if(++count===bucketSize){ranges.push([groupStart,groupEnd,count]);count=0;groupStart=-1;}}
5686 doLoop.call(this,loopIterationCallback);if(count>0)
5687 ranges.push([groupStart,groupEnd,count]);return ranges;}
5688 function callback(ranges)
5689 {if(ranges.length==1)
5690 WebInspector.ArrayGroupingTreeElement._populateAsFragment(treeElement,object,ranges[0][0],ranges[0][1]);else{for(var i=0;i<ranges.length;++i){var fromIndex=ranges[i][0];var toIndex=ranges[i][1];var count=ranges[i][2];if(fromIndex==toIndex)
5691 WebInspector.ArrayGroupingTreeElement._populateAsFragment(treeElement,object,fromIndex,toIndex);else
5692 treeElement.appendChild(new WebInspector.ArrayGroupingTreeElement(object,fromIndex,toIndex,count));}}
5693 if(topLevel)
5694 WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties(treeElement,object);}}
5695 WebInspector.ArrayGroupingTreeElement._populateAsFragment=function(treeElement,object,fromIndex,toIndex)
5696 {object.callFunction(buildArrayFragment,[{value:fromIndex},{value:toIndex},{value:WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold}],processArrayFragment.bind(this));function buildArrayFragment(fromIndex,toIndex,sparseIterationThreshold)
5697 {var result=Object.create(null);if(toIndex-fromIndex<sparseIterationThreshold){for(var i=fromIndex;i<=toIndex;++i){if(i in this)
5698 result[i]=this[i];}}else{var ownPropertyNames=Object.getOwnPropertyNames(this);for(var i=0;i<ownPropertyNames.length;++i){var name=ownPropertyNames[i];var index=name>>>0;if(String(index)===name&&fromIndex<=index&&index<=toIndex)
5699 result[index]=this[index];}}
5700 return result;}
5701 function processArrayFragment(arrayFragment,wasThrown)
5702 {if(!arrayFragment||wasThrown)
5703 return;arrayFragment.getAllProperties(false,processProperties.bind(this));}
5704 function processProperties(properties,internalProperties)
5705 {if(!properties)
5706 return;properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);for(var i=0;i<properties.length;++i){properties[i].parentObject=this._object;var childTreeElement=new treeElement.treeOutline.section.treeElementConstructor(properties[i]);childTreeElement._readOnly=true;treeElement.appendChild(childTreeElement);}}}
5707 WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties=function(treeElement,object)
5708 {object.callFunction(buildObjectFragment,undefined,processObjectFragment.bind(this));function buildObjectFragment()
5709 {var result=Object.create(this.__proto__);var names=Object.getOwnPropertyNames(this);for(var i=0;i<names.length;++i){var name=names[i];if(String(name>>>0)===name&&name>>>0!==0xffffffff)
5710 continue;var descriptor=Object.getOwnPropertyDescriptor(this,name);if(descriptor)
5711 Object.defineProperty(result,name,descriptor);}
5712 return result;}
5713 function processObjectFragment(arrayFragment,wasThrown)
5714 {if(!arrayFragment||wasThrown)
5715 return;arrayFragment.getOwnProperties(processProperties.bind(this));}
5716 function processProperties(properties,internalProperties)
5717 {if(!properties)
5718 return;properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);for(var i=0;i<properties.length;++i){properties[i].parentObject=this._object;var childTreeElement=new treeElement.treeOutline.section.treeElementConstructor(properties[i]);childTreeElement._readOnly=true;treeElement.appendChild(childTreeElement);}}}
5719 WebInspector.ArrayGroupingTreeElement.prototype={onpopulate:function()
5720 {if(this._populated)
5721 return;this._populated=true;if(this._propertyCount>=WebInspector.ArrayGroupingTreeElement._bucketThreshold){WebInspector.ArrayGroupingTreeElement._populateRanges(this,this._object,this._fromIndex,this._toIndex,false);return;}
5722 WebInspector.ArrayGroupingTreeElement._populateAsFragment(this,this._object,this._fromIndex,this._toIndex);},onattach:function()
5723 {this.listItemElement.classList.add("name");},__proto__:TreeElement.prototype}
5724 WebInspector.ObjectPropertyPrompt=function(commitHandler,cancelHandler,renderAsBlock)
5725 {WebInspector.TextPrompt.call(this,WebInspector.runtimeModel.completionsForTextPrompt.bind(WebInspector.runtimeModel));this.setSuggestBoxEnabled("generic-suggest");if(renderAsBlock)
5726 this.renderAsBlock();}
5727 WebInspector.ObjectPropertyPrompt.prototype={__proto__:WebInspector.TextPrompt.prototype}
5728 WebInspector.ObjectPopoverHelper=function(panelElement,getAnchor,queryObject,onHide,disableOnClick)
5729 {WebInspector.PopoverHelper.call(this,panelElement,getAnchor,this._showObjectPopover.bind(this),this._onHideObjectPopover.bind(this),disableOnClick);this._queryObject=queryObject;this._onHideCallback=onHide;this._popoverObjectGroup="popover";panelElement.addEventListener("scroll",this.hidePopover.bind(this),true);};WebInspector.ObjectPopoverHelper.prototype={setRemoteObjectFormatter:function(formatter)
5730 {this._remoteObjectFormatter=formatter;},_showObjectPopover:function(element,popover)
5731 {function didGetDetails(anchorElement,popoverContentElement,error,response)
5732 {if(error){console.error(error);return;}
5733 var container=document.createElement("div");container.className="inline-block";var title=container.createChild("div","function-popover-title source-code");var functionName=title.createChild("span","function-name");functionName.textContent=response.functionName||WebInspector.UIString("(anonymous function)");this._linkifier=new WebInspector.Linkifier();var rawLocation=(response.location);var link=this._linkifier.linkifyRawLocation(rawLocation,"function-location-link");if(link)
5734 title.appendChild(link);container.appendChild(popoverContentElement);popover.show(container,anchorElement);}
5735 function showObjectPopover(result,wasThrown,anchorOverride)
5736 {if(popover.disposed)
5737 return;if(wasThrown){this.hidePopover();return;}
5738 var anchorElement=anchorOverride||element;var description=(this._remoteObjectFormatter&&this._remoteObjectFormatter(result))||result.description;var popoverContentElement=null;if(result.type!=="object"){popoverContentElement=document.createElement("span");popoverContentElement.className="monospace console-formatted-"+result.type;popoverContentElement.style.whiteSpace="pre";popoverContentElement.textContent=description;if(result.type==="function"){DebuggerAgent.getFunctionDetails(result.objectId,didGetDetails.bind(this,anchorElement,popoverContentElement));return;}
5739 if(result.type==="string")
5740 popoverContentElement.textContent="\""+popoverContentElement.textContent+"\"";popover.show(popoverContentElement,anchorElement);}else{if(result.subtype==="node")
5741 result.highlightAsDOMNode();popoverContentElement=document.createElement("div");this._titleElement=document.createElement("div");this._titleElement.className="source-frame-popover-title monospace";this._titleElement.textContent=description;popoverContentElement.appendChild(this._titleElement);var section=new WebInspector.ObjectPropertiesSection(result);if(description.substr(0,4)==="HTML"){this._sectionUpdateProperties=section.updateProperties.bind(section);section.updateProperties=this._updateHTMLId.bind(this);}
5742 section.expanded=true;section.element.classList.add("source-frame-popover-tree");section.headerElement.classList.add("hidden");popoverContentElement.appendChild(section.element);const popoverWidth=300;const popoverHeight=250;popover.show(popoverContentElement,anchorElement,popoverWidth,popoverHeight);}}
5743 this._queryObject(element,showObjectPopover.bind(this),this._popoverObjectGroup);},_onHideObjectPopover:function()
5744 {WebInspector.domAgent.hideDOMNodeHighlight();if(this._linkifier){this._linkifier.reset();delete this._linkifier;}
5745 if(this._onHideCallback)
5746 this._onHideCallback();RuntimeAgent.releaseObjectGroup(this._popoverObjectGroup);},_updateHTMLId:function(properties,rootTreeElementConstructor,rootPropertyComparer)
5747 {for(var i=0;i<properties.length;++i){if(properties[i].name==="id"){if(properties[i].value.description)
5748 this._titleElement.textContent+="#"+properties[i].value.description;break;}}
5749 this._sectionUpdateProperties(properties,rootTreeElementConstructor,rootPropertyComparer);},__proto__:WebInspector.PopoverHelper.prototype}
5750 WebInspector.NativeBreakpointsSidebarPane=function(title)
5751 {WebInspector.SidebarPane.call(this,title);this.registerRequiredCSS("breakpointsList.css");this.listElement=document.createElement("ol");this.listElement.className="breakpoint-list";this.emptyElement=document.createElement("div");this.emptyElement.className="info";this.emptyElement.textContent=WebInspector.UIString("No Breakpoints");this.bodyElement.appendChild(this.emptyElement);}
5752 WebInspector.NativeBreakpointsSidebarPane.prototype={_addListElement:function(element,beforeElement)
5753 {if(beforeElement)
5754 this.listElement.insertBefore(element,beforeElement);else{if(!this.listElement.firstChild){this.bodyElement.removeChild(this.emptyElement);this.bodyElement.appendChild(this.listElement);}
5755 this.listElement.appendChild(element);}},_removeListElement:function(element)
5756 {this.listElement.removeChild(element);if(!this.listElement.firstChild){this.bodyElement.removeChild(this.listElement);this.bodyElement.appendChild(this.emptyElement);}},_reset:function()
5757 {this.listElement.removeChildren();if(this.listElement.parentElement){this.bodyElement.removeChild(this.listElement);this.bodyElement.appendChild(this.emptyElement);}},__proto__:WebInspector.SidebarPane.prototype}
5758 WebInspector.DOMBreakpointsSidebarPane=function()
5759 {WebInspector.NativeBreakpointsSidebarPane.call(this,WebInspector.UIString("DOM Breakpoints"));this._breakpointElements={};this._breakpointTypes={SubtreeModified:"subtree-modified",AttributeModified:"attribute-modified",NodeRemoved:"node-removed"};this._breakpointTypeLabels={};this._breakpointTypeLabels[this._breakpointTypes.SubtreeModified]=WebInspector.UIString("Subtree Modified");this._breakpointTypeLabels[this._breakpointTypes.AttributeModified]=WebInspector.UIString("Attribute Modified");this._breakpointTypeLabels[this._breakpointTypes.NodeRemoved]=WebInspector.UIString("Node Removed");this._contextMenuLabels={};this._contextMenuLabels[this._breakpointTypes.SubtreeModified]=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Subtree modifications":"Subtree Modifications");this._contextMenuLabels[this._breakpointTypes.AttributeModified]=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Attributes modifications":"Attributes Modifications");this._contextMenuLabels[this._breakpointTypes.NodeRemoved]=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Node removal":"Node Removal");WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._inspectedURLChanged,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeRemoved,this._nodeRemoved,this);}
5760 WebInspector.DOMBreakpointsSidebarPane.prototype={_inspectedURLChanged:function(event)
5761 {this._breakpointElements={};this._reset();var url=(event.data);this._inspectedURL=url.removeURLFragment();},populateNodeContextMenu:function(node,contextMenu)
5762 {if(node.pseudoType())
5763 return;var nodeBreakpoints={};for(var id in this._breakpointElements){var element=this._breakpointElements[id];if(element._node===node)
5764 nodeBreakpoints[element._type]=true;}
5765 function toggleBreakpoint(type)
5766 {if(!nodeBreakpoints[type])
5767 this._setBreakpoint(node,type,true);else
5768 this._removeBreakpoint(node,type);this._saveBreakpoints();}
5769 var breakPointSubMenu=contextMenu.appendSubMenuItem(WebInspector.UIString("Break on..."));for(var key in this._breakpointTypes){var type=this._breakpointTypes[key];var label=this._contextMenuLabels[type];breakPointSubMenu.appendCheckboxItem(label,toggleBreakpoint.bind(this,type),nodeBreakpoints[type]);}},createBreakpointHitStatusMessage:function(auxData,callback)
5770 {if(auxData.type===this._breakpointTypes.SubtreeModified){var targetNodeObject=WebInspector.RemoteObject.fromPayload(auxData["targetNode"]);targetNodeObject.pushNodeToFrontend(didPushNodeToFrontend.bind(this));}else
5771 this._doCreateBreakpointHitStatusMessage(auxData,null,callback);function didPushNodeToFrontend(targetNodeId)
5772 {if(targetNodeId)
5773 targetNodeObject.release();this._doCreateBreakpointHitStatusMessage(auxData,targetNodeId,callback);}},_doCreateBreakpointHitStatusMessage:function(auxData,targetNodeId,callback)
5774 {var message;var typeLabel=this._breakpointTypeLabels[auxData.type];var linkifiedNode=WebInspector.DOMPresentationUtils.linkifyNodeById(auxData.nodeId);var substitutions=[typeLabel,linkifiedNode];var targetNode="";if(targetNodeId)
5775 targetNode=WebInspector.DOMPresentationUtils.linkifyNodeById(targetNodeId);if(auxData.type===this._breakpointTypes.SubtreeModified){if(auxData.insertion){if(targetNodeId!==auxData.nodeId){message="Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s.";substitutions.push(targetNode);}else
5776 message="Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node.";}else{message="Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed.";substitutions.push(targetNode);}}else
5777 message="Paused on a \"%s\" breakpoint set on %s.";var element=document.createElement("span");var formatters={s:function(substitution)
5778 {return substitution;}};function append(a,b)
5779 {if(typeof b==="string")
5780 b=document.createTextNode(b);element.appendChild(b);}
5781 WebInspector.formatLocalized(message,substitutions,formatters,"",append);callback(element);},_nodeRemoved:function(event)
5782 {var node=event.data.node;this._removeBreakpointsForNode(event.data.node);var children=node.children();if(!children)
5783 return;for(var i=0;i<children.length;++i)
5784 this._removeBreakpointsForNode(children[i]);this._saveBreakpoints();},_removeBreakpointsForNode:function(node)
5785 {for(var id in this._breakpointElements){var element=this._breakpointElements[id];if(element._node===node)
5786 this._removeBreakpoint(element._node,element._type);}},_setBreakpoint:function(node,type,enabled)
5787 {var breakpointId=this._createBreakpointId(node.id,type);if(breakpointId in this._breakpointElements)
5788 return;var element=document.createElement("li");element._node=node;element._type=type;element.addEventListener("contextmenu",this._contextMenu.bind(this,node,type),true);var checkboxElement=document.createElement("input");checkboxElement.className="checkbox-elem";checkboxElement.type="checkbox";checkboxElement.checked=enabled;checkboxElement.addEventListener("click",this._checkboxClicked.bind(this,node,type),false);element._checkboxElement=checkboxElement;element.appendChild(checkboxElement);var labelElement=document.createElement("span");element.appendChild(labelElement);var linkifiedNode=WebInspector.DOMPresentationUtils.linkifyNodeById(node.id);linkifiedNode.classList.add("monospace");labelElement.appendChild(linkifiedNode);var description=document.createElement("div");description.className="source-text";description.textContent=this._breakpointTypeLabels[type];labelElement.appendChild(description);var currentElement=this.listElement.firstChild;while(currentElement){if(currentElement._type&&currentElement._type<element._type)
5789 break;currentElement=currentElement.nextSibling;}
5790 this._addListElement(element,currentElement);this._breakpointElements[breakpointId]=element;if(enabled)
5791 DOMDebuggerAgent.setDOMBreakpoint(node.id,type);},_removeAllBreakpoints:function()
5792 {for(var id in this._breakpointElements){var element=this._breakpointElements[id];this._removeBreakpoint(element._node,element._type);}
5793 this._saveBreakpoints();},_removeBreakpoint:function(node,type)
5794 {var breakpointId=this._createBreakpointId(node.id,type);var element=this._breakpointElements[breakpointId];if(!element)
5795 return;this._removeListElement(element);delete this._breakpointElements[breakpointId];if(element._checkboxElement.checked)
5796 DOMDebuggerAgent.removeDOMBreakpoint(node.id,type);},_contextMenu:function(node,type,event)
5797 {var contextMenu=new WebInspector.ContextMenu(event);function removeBreakpoint()
5798 {this._removeBreakpoint(node,type);this._saveBreakpoints();}
5799 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove breakpoint":"Remove Breakpoint"),removeBreakpoint.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove all DOM breakpoints":"Remove All DOM Breakpoints"),this._removeAllBreakpoints.bind(this));contextMenu.show();},_checkboxClicked:function(node,type,event)
5800 {if(event.target.checked)
5801 DOMDebuggerAgent.setDOMBreakpoint(node.id,type);else
5802 DOMDebuggerAgent.removeDOMBreakpoint(node.id,type);this._saveBreakpoints();},highlightBreakpoint:function(auxData)
5803 {var breakpointId=this._createBreakpointId(auxData.nodeId,auxData.type);var element=this._breakpointElements[breakpointId];if(!element)
5804 return;this.expand();element.classList.add("breakpoint-hit");this._highlightedElement=element;},clearBreakpointHighlight:function()
5805 {if(this._highlightedElement){this._highlightedElement.classList.remove("breakpoint-hit");delete this._highlightedElement;}},_createBreakpointId:function(nodeId,type)
5806 {return nodeId+":"+type;},_saveBreakpoints:function()
5807 {var breakpoints=[];var storedBreakpoints=WebInspector.settings.domBreakpoints.get();for(var i=0;i<storedBreakpoints.length;++i){var breakpoint=storedBreakpoints[i];if(breakpoint.url!==this._inspectedURL)
5808 breakpoints.push(breakpoint);}
5809 for(var id in this._breakpointElements){var element=this._breakpointElements[id];breakpoints.push({url:this._inspectedURL,path:element._node.path(),type:element._type,enabled:element._checkboxElement.checked});}
5810 WebInspector.settings.domBreakpoints.set(breakpoints);},restoreBreakpoints:function()
5811 {var pathToBreakpoints={};function didPushNodeByPathToFrontend(path,nodeId)
5812 {var node=nodeId?WebInspector.domAgent.nodeForId(nodeId):null;if(!node)
5813 return;var breakpoints=pathToBreakpoints[path];for(var i=0;i<breakpoints.length;++i)
5814 this._setBreakpoint(node,breakpoints[i].type,breakpoints[i].enabled);}
5815 var breakpoints=WebInspector.settings.domBreakpoints.get();for(var i=0;i<breakpoints.length;++i){var breakpoint=breakpoints[i];if(breakpoint.url!==this._inspectedURL)
5816 continue;var path=breakpoint.path;if(!pathToBreakpoints[path]){pathToBreakpoints[path]=[];WebInspector.domAgent.pushNodeByPathToFrontend(path,didPushNodeByPathToFrontend.bind(this,path));}
5817 pathToBreakpoints[path].push(breakpoint);}},createProxy:function(panel)
5818 {var proxy=new WebInspector.DOMBreakpointsSidebarPane.Proxy(this,panel);if(!this._proxies)
5819 this._proxies=[];this._proxies.push(proxy);return proxy;},onContentReady:function()
5820 {for(var i=0;i!=this._proxies.length;i++)
5821 this._proxies[i].onContentReady();},__proto__:WebInspector.NativeBreakpointsSidebarPane.prototype}
5822 WebInspector.DOMBreakpointsSidebarPane.Proxy=function(pane,panel)
5823 {WebInspector.View._assert(!pane.titleElement.firstChild,"Cannot create proxy for a sidebar pane with a toolbar");WebInspector.SidebarPane.call(this,pane.title());this.registerRequiredCSS("breakpointsList.css");this._wrappedPane=pane;this._panel=panel;this.bodyElement.remove();this.bodyElement=this._wrappedPane.bodyElement;}
5824 WebInspector.DOMBreakpointsSidebarPane.Proxy.prototype={expand:function()
5825 {this._wrappedPane.expand();},onContentReady:function()
5826 {if(this._panel.isShowing())
5827 this._reattachBody();WebInspector.SidebarPane.prototype.onContentReady.call(this);},wasShown:function()
5828 {WebInspector.SidebarPane.prototype.wasShown.call(this);this._reattachBody();},_reattachBody:function()
5829 {if(this.bodyElement.parentNode!==this.element)
5830 this.element.appendChild(this.bodyElement);},__proto__:WebInspector.SidebarPane.prototype}
5831 WebInspector.domBreakpointsSidebarPane;WebInspector.Color=function(rgba,format,originalText)
5832 {this._rgba=rgba;this._originalText=originalText||null;this._format=format||null;if(typeof this._rgba[3]==="undefined")
5833 this._rgba[3]=1;for(var i=0;i<4;++i){if(this._rgba[i]<0)
5834 this._rgba[i]=0;if(this._rgba[i]>1)
5835 this._rgba[i]=1;}}
5836 WebInspector.Color.parse=function(text)
5837 {var value=text.toLowerCase().replace(/\s+/g,"");var simple=/^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;var match=value.match(simple);if(match){if(match[1]){var hex=match[1].toUpperCase();var format;if(hex.length===3){format=WebInspector.Color.Format.ShortHEX;hex=hex.charAt(0)+hex.charAt(0)+hex.charAt(1)+hex.charAt(1)+hex.charAt(2)+hex.charAt(2);}else
5838 format=WebInspector.Color.Format.HEX;var r=parseInt(hex.substring(0,2),16);var g=parseInt(hex.substring(2,4),16);var b=parseInt(hex.substring(4,6),16);return new WebInspector.Color([r/255,g/255,b/255,1],format,text);}
5839 if(match[2]){var rgbString=match[2].split(/\s*,\s*/);var rgba=[WebInspector.Color._parseRgbNumeric(rgbString[0]),WebInspector.Color._parseRgbNumeric(rgbString[1]),WebInspector.Color._parseRgbNumeric(rgbString[2]),1];return new WebInspector.Color(rgba,WebInspector.Color.Format.RGB,text);}
5840 if(match[3]){var nickname=match[3].toLowerCase();if(nickname in WebInspector.Color.Nicknames){var rgba=WebInspector.Color.Nicknames[nickname];var color=WebInspector.Color.fromRGBA(rgba);color._format=WebInspector.Color.Format.Nickname;color._originalText=nickname;return color;}
5841 return null;}
5842 if(match[4]){var hslString=match[4].replace(/%/g,"").split(/\s*,\s*/);var hsla=[WebInspector.Color._parseHueNumeric(hslString[0]),WebInspector.Color._parseSatLightNumeric(hslString[1]),WebInspector.Color._parseSatLightNumeric(hslString[2]),1];var rgba=WebInspector.Color._hsl2rgb(hsla);return new WebInspector.Color(rgba,WebInspector.Color.Format.HSL,text);}
5843 return null;}
5844 var advanced=/^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;match=value.match(advanced);if(match){if(match[1]){var rgbaString=match[1].split(/\s*,\s*/);var rgba=[WebInspector.Color._parseRgbNumeric(rgbaString[0]),WebInspector.Color._parseRgbNumeric(rgbaString[1]),WebInspector.Color._parseRgbNumeric(rgbaString[2]),WebInspector.Color._parseAlphaNumeric(rgbaString[3])];return new WebInspector.Color(rgba,WebInspector.Color.Format.RGBA,text);}
5845 if(match[2]){var hslaString=match[2].replace(/%/g,"").split(/\s*,\s*/);var hsla=[WebInspector.Color._parseHueNumeric(hslaString[0]),WebInspector.Color._parseSatLightNumeric(hslaString[1]),WebInspector.Color._parseSatLightNumeric(hslaString[2]),WebInspector.Color._parseAlphaNumeric(hslaString[3])];var rgba=WebInspector.Color._hsl2rgb(hsla);return new WebInspector.Color(rgba,WebInspector.Color.Format.HSLA,text);}}
5846 return null;}
5847 WebInspector.Color.fromRGBA=function(rgba)
5848 {return new WebInspector.Color([rgba[0]/255,rgba[1]/255,rgba[2]/255,rgba[3]]);}
5849 WebInspector.Color.fromHSVA=function(hsva)
5850 {var h=hsva[0];var s=hsva[1];var v=hsva[2];var t=(2-s)*v;if(v===0||s===0)
5851 s=0;else
5852 s*=v/(t<1?t:2-t);var hsla=[h,s,t/2,hsva[3]];return new WebInspector.Color(WebInspector.Color._hsl2rgb(hsla),WebInspector.Color.Format.HSLA);}
5853 WebInspector.Color.prototype={format:function()
5854 {return this._format;},hsla:function()
5855 {if(this._hsla)
5856 return this._hsla;var r=this._rgba[0];var g=this._rgba[1];var b=this._rgba[2];var max=Math.max(r,g,b);var min=Math.min(r,g,b);var diff=max-min;var add=max+min;if(min===max)
5857 var h=0;else if(r===max)
5858 var h=((1/6*(g-b)/diff)+1)%1;else if(g===max)
5859 var h=(1/6*(b-r)/diff)+1/3;else
5860 var h=(1/6*(r-g)/diff)+2/3;var l=0.5*add;if(l===0)
5861 var s=0;else if(l===1)
5862 var s=1;else if(l<=0.5)
5863 var s=diff/add;else
5864 var s=diff/(2-add);this._hsla=[h,s,l,this._rgba[3]];return this._hsla;},hsva:function()
5865 {var hsla=this.hsla();var h=hsla[0];var s=hsla[1];var l=hsla[2];s*=l<0.5?l:1-l;return[h,s!==0?2*s/(l+s):0,(l+s),hsla[3]];},hasAlpha:function()
5866 {return this._rgba[3]!==1;},canBeShortHex:function()
5867 {if(this.hasAlpha())
5868 return false;for(var i=0;i<3;++i){var c=Math.round(this._rgba[i]*255);if(c%17)
5869 return false;}
5870 return true;},toString:function(format)
5871 {if(!format)
5872 format=this._format;function toRgbValue(value)
5873 {return Math.round(value*255);}
5874 function toHexValue(value)
5875 {var hex=Math.round(value*255).toString(16);return hex.length===1?"0"+hex:hex;}
5876 function toShortHexValue(value)
5877 {return(Math.round(value*255)/17).toString(16);}
5878 switch(format){case WebInspector.Color.Format.Original:return this._originalText;case WebInspector.Color.Format.RGB:if(this.hasAlpha())
5879 return null;return String.sprintf("rgb(%d, %d, %d)",toRgbValue(this._rgba[0]),toRgbValue(this._rgba[1]),toRgbValue(this._rgba[2]));case WebInspector.Color.Format.RGBA:return String.sprintf("rgba(%d, %d, %d, %f)",toRgbValue(this._rgba[0]),toRgbValue(this._rgba[1]),toRgbValue(this._rgba[2]),this._rgba[3]);case WebInspector.Color.Format.HSL:if(this.hasAlpha())
5880 return null;var hsl=this.hsla();return String.sprintf("hsl(%d, %d%, %d%)",Math.round(hsl[0]*360),Math.round(hsl[1]*100),Math.round(hsl[2]*100));case WebInspector.Color.Format.HSLA:var hsla=this.hsla();return String.sprintf("hsla(%d, %d%, %d%, %f)",Math.round(hsla[0]*360),Math.round(hsla[1]*100),Math.round(hsla[2]*100),hsla[3]);case WebInspector.Color.Format.HEX:if(this.hasAlpha())
5881 return null;return String.sprintf("#%s%s%s",toHexValue(this._rgba[0]),toHexValue(this._rgba[1]),toHexValue(this._rgba[2])).toUpperCase();case WebInspector.Color.Format.ShortHEX:if(!this.canBeShortHex())
5882 return null;return String.sprintf("#%s%s%s",toShortHexValue(this._rgba[0]),toShortHexValue(this._rgba[1]),toShortHexValue(this._rgba[2])).toUpperCase();case WebInspector.Color.Format.Nickname:return this.nickname();}
5883 return this._originalText;},_canonicalRGBA:function()
5884 {var rgba=new Array(3);for(var i=0;i<3;++i)
5885 rgba[i]=Math.round(this._rgba[i]*255);if(this._rgba[3]!==1)
5886 rgba.push(this._rgba[3]);return rgba;},nickname:function()
5887 {if(!WebInspector.Color._rgbaToNickname){WebInspector.Color._rgbaToNickname={};for(var nickname in WebInspector.Color.Nicknames){var rgba=WebInspector.Color.Nicknames[nickname];WebInspector.Color._rgbaToNickname[rgba]=nickname;}}
5888 return WebInspector.Color._rgbaToNickname[this._canonicalRGBA()]||null;},toProtocolRGBA:function()
5889 {var rgba=this._canonicalRGBA();var result={r:rgba[0],g:rgba[1],b:rgba[2]};if(rgba[3]!==1)
5890 result.a=rgba[3];return result;},invert:function()
5891 {var rgba=[];rgba[0]=1-this._rgba[0];rgba[1]=1-this._rgba[1];rgba[2]=1-this._rgba[2];rgba[3]=this._rgba[3];return new WebInspector.Color(rgba);},setAlpha:function(alpha)
5892 {var rgba=this._rgba.slice();rgba[3]=alpha;return new WebInspector.Color(rgba);}}
5893 WebInspector.Color._parseRgbNumeric=function(value)
5894 {var parsed=parseInt(value,10);if(value.indexOf("%")!==-1)
5895 parsed/=100;else
5896 parsed/=255;return parsed;}
5897 WebInspector.Color._parseHueNumeric=function(value)
5898 {return isNaN(value)?0:(parseFloat(value)/360)%1;}
5899 WebInspector.Color._parseSatLightNumeric=function(value)
5900 {return parseFloat(value)/100;}
5901 WebInspector.Color._parseAlphaNumeric=function(value)
5902 {return isNaN(value)?0:parseFloat(value);}
5903 WebInspector.Color._hsl2rgb=function(hsl)
5904 {var h=hsl[0];var s=hsl[1];var l=hsl[2];function hue2rgb(p,q,h)
5905 {if(h<0)
5906 h+=1;else if(h>1)
5907 h-=1;if((h*6)<1)
5908 return p+(q-p)*h*6;else if((h*2)<1)
5909 return q;else if((h*3)<2)
5910 return p+(q-p)*((2/3)-h)*6;else
5911 return p;}
5912 if(s<0)
5913 s=0;if(l<=0.5)
5914 var q=l*(1+s);else
5915 var q=l+s-(l*s);var p=2*l-q;var tr=h+(1/3);var tg=h;var tb=h-(1/3);var r=hue2rgb(p,q,tr);var g=hue2rgb(p,q,tg);var b=hue2rgb(p,q,tb);return[r,g,b,hsl[3]];}
5916 WebInspector.Color.Nicknames={"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,20,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],"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],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[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],"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],"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],"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],"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],"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],"transparent":[0,0,0,0],};WebInspector.Color.PageHighlight={Content:WebInspector.Color.fromRGBA([111,168,220,.66]),ContentLight:WebInspector.Color.fromRGBA([111,168,220,.5]),ContentOutline:WebInspector.Color.fromRGBA([9,83,148]),Padding:WebInspector.Color.fromRGBA([147,196,125,.55]),PaddingLight:WebInspector.Color.fromRGBA([147,196,125,.4]),Border:WebInspector.Color.fromRGBA([255,229,153,.66]),BorderLight:WebInspector.Color.fromRGBA([255,229,153,.5]),Margin:WebInspector.Color.fromRGBA([246,178,107,.66]),MarginLight:WebInspector.Color.fromRGBA([246,178,107,.5]),EventTarget:WebInspector.Color.fromRGBA([255,196,196,.66])}
5917 WebInspector.Color.Format={Original:"original",Nickname:"nickname",HEX:"hex",ShortHEX:"shorthex",RGB:"rgb",RGBA:"rgba",HSL:"hsl",HSLA:"hsla"}
5918 WebInspector.CSSMetadata=function(properties)
5919 {this._values=([]);this._longhands={};this._shorthands={};for(var i=0;i<properties.length;++i){var property=properties[i];if(typeof property==="string"){this._values.push(property);continue;}
5920 var propertyName=property.name;this._values.push(propertyName);var longhands=properties[i].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;}
5921 shorthands.push(propertyName);}}}
5922 this._values.sort();}
5923 WebInspector.CSSMetadata.cssPropertiesMetainfo=new WebInspector.CSSMetadata([]);WebInspector.CSSMetadata.isColorAwareProperty=function(propertyName)
5924 {return WebInspector.CSSMetadata._colorAwareProperties[propertyName]===true;}
5925 WebInspector.CSSMetadata.colors=function()
5926 {if(!WebInspector.CSSMetadata._colorsKeySet)
5927 WebInspector.CSSMetadata._colorsKeySet=WebInspector.CSSMetadata._colors.keySet();return WebInspector.CSSMetadata._colorsKeySet;}
5928 WebInspector.CSSMetadata.InheritedProperties=["azimuth","border-collapse","border-spacing","caption-side","color","cursor","direction","elevation","empty-cells","font-family","font-size","font-style","font-variant","font-weight","font","letter-spacing","line-height","list-style-image","list-style-position","list-style-type","list-style","orphans","pitch-range","pitch","quotes","resize","richness","speak-header","speak-numeral","speak-punctuation","speak","speech-rate","stress","text-align","text-indent","text-transform","text-shadow","visibility","voice-family","volume","white-space","widows","word-spacing","zoom"].keySet();WebInspector.CSSMetadata.NonStandardInheritedProperties=["-webkit-font-smoothing"].keySet();WebInspector.CSSMetadata.canonicalPropertyName=function(name)
5929 {if(!name||name.length<9||name.charAt(0)!=="-")
5930 return name.toLowerCase();var match=name.match(/(?:-webkit-)(.+)/);if(!match)
5931 return name.toLowerCase();return match[1].toLowerCase();}
5932 WebInspector.CSSMetadata.isPropertyInherited=function(propertyName)
5933 {return!!(WebInspector.CSSMetadata.InheritedProperties[WebInspector.CSSMetadata.canonicalPropertyName(propertyName)]||WebInspector.CSSMetadata.NonStandardInheritedProperties[propertyName.toLowerCase()]);}
5934 WebInspector.CSSMetadata._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","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen"];WebInspector.CSSMetadata._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-color","text-overline-color","text-shadow","text-underline-color","-webkit-box-shadow","-webkit-column-rule-color","-webkit-text-decoration-color","-webkit-text-emphasis","-webkit-text-emphasis-color"].keySet();WebInspector.CSSMetadata._propertyDataMap={"table-layout":{values:["auto","fixed"]},"visibility":{values:["hidden","visible","collapse"]},"background-repeat":{values:["repeat","repeat-x","repeat-y","no-repeat","space","round"]},"content":{values:["list-item","close-quote","no-close-quote","no-open-quote","open-quote"]},"list-style-image":{values:["none"]},"clear":{values:["none","left","right","both"]},"text-underline-mode":{values:["continuous","skip-white-space"]},"overflow-x":{values:["hidden","auto","visible","overlay","scroll"]},"stroke-linejoin":{values:["round","miter","bevel"]},"baseline-shift":{values:["baseline","sub","super"]},"border-bottom-width":{values:["medium","thick","thin"]},"marquee-speed":{values:["normal","slow","fast"]},"margin-top-collapse":{values:["collapse","separate","discard"]},"max-height":{values:["none"]},"box-orient":{values:["horizontal","vertical","inline-axis","block-axis"],},"font-stretch":{values:["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded"]},"text-underline-style":{values:["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"]},"text-overline-mode":{values:["continuous","skip-white-space"]},"-webkit-background-composite":{values:["highlight","clear","copy","source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","xor","plus-darker","plus-lighter"]},"border-left-width":{values:["medium","thick","thin"]},"box-shadow":{values:["inset","none"]},"-webkit-writing-mode":{values:["lr","rl","tb","lr-tb","rl-tb","tb-rl","horizontal-tb","vertical-rl","vertical-lr","horizontal-bt"]},"text-line-through-mode":{values:["continuous","skip-white-space"]},"border-collapse":{values:["collapse","separate"]},"page-break-inside":{values:["auto","avoid"]},"border-top-width":{values:["medium","thick","thin"]},"outline-color":{values:["invert"]},"text-line-through-style":{values:["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"]},"outline-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"cursor":{values:["none","copy","auto","crosshair","default","pointer","move","vertical-text","cell","context-menu","alias","progress","no-drop","not-allowed","-webkit-zoom-in","-webkit-zoom-out","e-resize","ne-resize","nw-resize","n-resize","se-resize","sw-resize","s-resize","w-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","col-resize","row-resize","text","wait","help","all-scroll","-webkit-grab","-webkit-grabbing"]},"border-width":{values:["medium","thick","thin"]},"size":{values:["a3","a4","a5","b4","b5","landscape","ledger","legal","letter","portrait"]},"background-size":{values:["contain","cover"]},"direction":{values:["ltr","rtl"]},"marquee-direction":{values:["left","right","auto","reverse","forwards","backwards","ahead","up","down"]},"enable-background":{values:["accumulate","new"]},"float":{values:["none","left","right"]},"overflow-y":{values:["hidden","auto","visible","overlay","scroll"]},"margin-bottom-collapse":{values:["collapse","separate","discard"]},"box-reflect":{values:["left","right","above","below"]},"overflow":{values:["hidden","auto","visible","overlay","scroll"]},"text-rendering":{values:["auto","optimizeSpeed","optimizeLegibility","geometricPrecision"]},"text-align":{values:["-webkit-auto","start","end","left","right","center","justify","-webkit-left","-webkit-right","-webkit-center"]},"list-style-position":{values:["outside","inside","hanging"]},"margin-bottom":{values:["auto"]},"color-interpolation":{values:["linearrgb"]},"background-origin":{values:["border-box","content-box","padding-box"]},"word-wrap":{values:["normal","break-word"]},"font-weight":{values:["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},"margin-before-collapse":{values:["collapse","separate","discard"]},"text-overline-width":{values:["normal","medium","auto","thick","thin"]},"text-transform":{values:["none","capitalize","uppercase","lowercase"]},"border-right-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"border-left-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"-webkit-text-emphasis":{values:["circle","filled","open","dot","double-circle","triangle","sesame"]},"font-style":{values:["italic","oblique","normal"]},"speak":{values:["none","normal","spell-out","digits","literal-punctuation","no-punctuation"]},"color-rendering":{values:["auto","optimizeSpeed","optimizeQuality"]},"list-style-type":{values:["none","inline","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":{values:["none","horizontal"]},"outline":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"font":{values:["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"]},"dominant-baseline":{values:["middle","auto","central","text-before-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","use-script","no-change","reset-size"]},"display":{values:["none","inline","block","list-item","run-in","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","flex","inline-flex","grid","inline-grid"]},"-webkit-text-emphasis-position":{values:["over","under"]},"image-rendering":{values:["auto","optimizeSpeed","optimizeQuality"]},"alignment-baseline":{values:["baseline","middle","auto","before-edge","after-edge","central","text-before-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical"]},"outline-width":{values:["medium","thick","thin"]},"text-line-through-width":{values:["normal","medium","auto","thick","thin"]},"box-align":{values:["baseline","center","stretch","start","end"]},"border-right-width":{values:["medium","thick","thin"]},"border-top-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"line-height":{values:["normal"]},"text-overflow":{values:["clip","ellipsis"]},"overflow-wrap":{values:["normal","break-word"]},"box-direction":{values:["normal","reverse"]},"margin-after-collapse":{values:["collapse","separate","discard"]},"page-break-before":{values:["left","right","auto","always","avoid"]},"border-image":{values:["repeat","stretch"]},"text-decoration":{values:["blink","line-through","overline","underline"]},"position":{values:["absolute","fixed","relative","static"]},"font-family":{values:["serif","sans-serif","cursive","fantasy","monospace","-webkit-body","-webkit-pictograph"]},"text-overflow-mode":{values:["clip","ellipsis"]},"border-bottom-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"unicode-bidi":{values:["normal","bidi-override","embed","isolate","isolate-override","plaintext"]},"clip-rule":{values:["nonzero","evenodd"]},"margin-left":{values:["auto"]},"margin-top":{values:["auto"]},"zoom":{values:["normal","document","reset"]},"text-overline-style":{values:["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"]},"max-width":{values:["none"]},"caption-side":{values:["top","bottom"]},"empty-cells":{values:["hide","show"]},"pointer-events":{values:["none","all","auto","visible","visiblepainted","visiblefill","visiblestroke","painted","fill","stroke","bounding-box"]},"letter-spacing":{values:["normal"]},"background-clip":{values:["border-box","content-box","padding-box"]},"-webkit-font-smoothing":{values:["none","auto","antialiased","subpixel-antialiased"]},"border":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"font-size":{values:["xx-small","x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large","smaller","larger"]},"font-variant":{values:["small-caps","normal"]},"vertical-align":{values:["baseline","middle","sub","super","text-top","text-bottom","top","bottom","-webkit-baseline-middle"]},"marquee-style":{values:["none","scroll","slide","alternate"]},"white-space":{values:["normal","nowrap","pre","pre-line","pre-wrap"]},"text-underline-width":{values:["normal","medium","auto","thick","thin"]},"box-lines":{values:["single","multiple"]},"page-break-after":{values:["left","right","auto","always","avoid"]},"clip-path":{values:["none"]},"margin":{values:["auto"]},"marquee-repetition":{values:["infinite"]},"margin-right":{values:["auto"]},"word-break":{values:["normal","break-all","break-word"]},"word-spacing":{values:["normal"]},"-webkit-text-emphasis-style":{values:["circle","filled","open","dot","double-circle","triangle","sesame"]},"-webkit-transform":{values:["scale","scaleX","scaleY","scale3d","rotate","rotateX","rotateY","rotateZ","rotate3d","skew","skewX","skewY","translate","translateX","translateY","translateZ","translate3d","matrix","matrix3d","perspective"]},"image-resolution":{values:["from-image","snap"]},"box-sizing":{values:["content-box","padding-box","border-box"]},"clip":{values:["auto"]},"resize":{values:["none","both","horizontal","vertical"]},"align-content":{values:["flex-start","flex-end","center","space-between","space-around","stretch"]},"align-items":{values:["flex-start","flex-end","center","baseline","stretch"]},"align-self":{values:["auto","flex-start","flex-end","center","baseline","stretch"]},"flex-direction":{values:["row","row-reverse","column","column-reverse"]},"justify-content":{values:["flex-start","flex-end","center","space-between","space-around"]},"flex-wrap":{values:["nowrap","wrap","wrap-reverse"]},"-webkit-animation-timing-function":{values:["ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps","cubic-bezier"]},"-webkit-animation-direction":{values:["normal","reverse","alternate","alternate-reverse"]},"-webkit-animation-play-state":{values:["running","paused"]},"-webkit-animation-fill-mode":{values:["none","forwards","backwards","both"]},"-webkit-backface-visibility":{values:["visible","hidden"]},"-webkit-box-decoration-break":{values:["slice","clone"]},"-webkit-column-break-after":{values:["auto","always","avoid","left","right","page","column","avoid-page","avoid-column"]},"-webkit-column-break-before":{values:["auto","always","avoid","left","right","page","column","avoid-page","avoid-column"]},"-webkit-column-break-inside":{values:["auto","avoid","avoid-page","avoid-column"]},"-webkit-column-span":{values:["none","all"]},"-webkit-column-count":{values:["auto"]},"-webkit-column-gap":{values:["normal"]},"-webkit-line-break":{values:["auto","loose","normal","strict"]},"-webkit-perspective":{values:["none"]},"-webkit-perspective-origin":{values:["left","center","right","top","bottom"]},"text-align-last":{values:["auto","start","end","left","right","center","justify"]},"-webkit-text-decoration-line":{values:["none","underline","overline","line-through","blink"]},"-webkit-text-decoration-style":{values:["solid","double","dotted","dashed","wavy"]},"-webkit-text-decoration-skip":{values:["none","objects","spaces","ink","edges","box-decoration"]},"-webkit-transform-origin":{values:["left","center","right","top","bottom"]},"-webkit-transform-style":{values:["flat","preserve-3d"]},"-webkit-transition-timing-function":{values:["ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps","cubic-bezier"]},"-webkit-flex":{m:"flexbox"},"-webkit-flex-basis":{m:"flexbox"},"-webkit-flex-flow":{m:"flexbox"},"-webkit-flex-grow":{m:"flexbox"},"-webkit-flex-shrink":{m:"flexbox"},"-webkit-animation":{m:"animations"},"-webkit-animation-delay":{m:"animations"},"-webkit-animation-duration":{m:"animations"},"-webkit-animation-iteration-count":{m:"animations"},"-webkit-animation-name":{m:"animations"},"-webkit-column-rule":{m:"multicol"},"-webkit-column-rule-color":{m:"multicol",a:"crc"},"-webkit-column-rule-style":{m:"multicol",a:"crs"},"-webkit-column-rule-width":{m:"multicol",a:"crw"},"-webkit-column-width":{m:"multicol",a:"cw"},"-webkit-columns":{m:"multicol"},"-webkit-order":{m:"flexbox"},"-webkit-text-decoration-color":{m:"text-decor"},"-webkit-text-emphasis-color":{m:"text-decor"},"-webkit-transition":{m:"transitions"},"-webkit-transition-delay":{m:"transitions"},"-webkit-transition-duration":{m:"transitions"},"-webkit-transition-property":{m:"transitions"},"background":{m:"background"},"background-attachment":{m:"background"},"background-color":{m:"background"},"background-image":{m:"background"},"background-position":{m:"background"},"background-position-x":{m:"background"},"background-position-y":{m:"background"},"background-repeat-x":{m:"background"},"background-repeat-y":{m:"background"},"border-top":{m:"background"},"border-right":{m:"background"},"border-bottom":{m:"background"},"border-left":{m:"background"},"border-radius":{m:"background"},"bottom":{m:"visuren"},"color":{m:"color",a:"foreground"},"counter-increment":{m:"generate"},"counter-reset":{m:"generate"},"grid-definition-columns":{m:"grid"},"grid-definition-rows":{m:"grid"},"height":{m:"box"},"image-orientation":{m:"images"},"left":{m:"visuren"},"list-style":{m:"lists"},"min-height":{m:"box"},"min-width":{m:"box"},"opacity":{m:"color",a:"transparency"},"orphans":{m:"page"},"outline-offset":{m:"ui"},"padding":{m:"box",a:"padding1"},"padding-bottom":{m:"box"},"padding-left":{m:"box"},"padding-right":{m:"box"},"padding-top":{m:"box"},"page":{m:"page"},"quotes":{m:"generate"},"right":{m:"visuren"},"tab-size":{m:"text"},"text-indent":{m:"text"},"text-shadow":{m:"text-decor"},"top":{m:"visuren"},"unicode-range":{m:"fonts",a:"descdef-unicode-range"},"widows":{m:"page"},"width":{m:"box"},"z-index":{m:"visuren"}}
5935 WebInspector.CSSMetadata.keywordsForProperty=function(propertyName)
5936 {var acceptedKeywords=["inherit","initial"];var descriptor=WebInspector.CSSMetadata.descriptor(propertyName);if(descriptor&&descriptor.values)
5937 acceptedKeywords.push.apply(acceptedKeywords,descriptor.values);if(propertyName in WebInspector.CSSMetadata._colorAwareProperties)
5938 acceptedKeywords.push.apply(acceptedKeywords,WebInspector.CSSMetadata._colors);return new WebInspector.CSSMetadata(acceptedKeywords);}
5939 WebInspector.CSSMetadata.descriptor=function(propertyName)
5940 {if(!propertyName)
5941 return null;var unprefixedName=propertyName.replace(/^-webkit-/,"");var entry=WebInspector.CSSMetadata._propertyDataMap[propertyName];if(!entry&&unprefixedName!==propertyName)
5942 entry=WebInspector.CSSMetadata._propertyDataMap[unprefixedName];return entry||null;}
5943 WebInspector.CSSMetadata.requestCSSShorthandData=function()
5944 {function propertyNamesCallback(error,properties)
5945 {if(!error)
5946 WebInspector.CSSMetadata.cssPropertiesMetainfo=new WebInspector.CSSMetadata(properties);}
5947 CSSAgent.getSupportedCSSProperties(propertyNamesCallback);}
5948 WebInspector.CSSMetadata.cssPropertiesMetainfoKeySet=function()
5949 {if(!WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet)
5950 WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet=WebInspector.CSSMetadata.cssPropertiesMetainfo.keySet();return WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet;}
5951 WebInspector.CSSMetadata.Weight={"-webkit-animation":1,"-webkit-animation-duration":1,"-webkit-animation-iteration-count":1,"-webkit-animation-name":1,"-webkit-animation-timing-function":1,"-webkit-appearance":1,"-webkit-background-clip":2,"-webkit-border-horizontal-spacing":1,"-webkit-border-vertical-spacing":1,"-webkit-box-shadow":24,"-webkit-font-smoothing":2,"-webkit-transform":1,"-webkit-transition":8,"-webkit-transition-delay":7,"-webkit-transition-duration":7,"-webkit-transition-property":7,"-webkit-transition-timing-function":6,"-webkit-user-select":1,"background":222,"background-attachment":144,"background-clip":143,"background-color":222,"background-image":201,"background-origin":142,"background-size":25,"border":121,"border-bottom":121,"border-bottom-color":121,"border-bottom-left-radius":50,"border-bottom-right-radius":50,"border-bottom-style":114,"border-bottom-width":120,"border-collapse":3,"border-left":95,"border-left-color":95,"border-left-style":89,"border-left-width":94,"border-radius":50,"border-right":93,"border-right-color":93,"border-right-style":88,"border-right-width":93,"border-top":111,"border-top-color":111,"border-top-left-radius":49,"border-top-right-radius":49,"border-top-style":104,"border-top-width":109,"bottom":16,"box-shadow":25,"box-sizing":2,"clear":23,"color":237,"cursor":34,"direction":4,"display":210,"fill":2,"filter":1,"float":105,"font":174,"font-family":25,"font-size":174,"font-style":9,"font-weight":89,"height":161,"left":54,"letter-spacing":3,"line-height":75,"list-style":17,"list-style-image":8,"list-style-position":8,"list-style-type":17,"margin":241,"margin-bottom":226,"margin-left":225,"margin-right":213,"margin-top":241,"max-height":5,"max-width":11,"min-height":9,"min-width":6,"opacity":24,"outline":10,"outline-color":10,"outline-style":10,"outline-width":10,"overflow":57,"overflow-x":56,"overflow-y":57,"padding":216,"padding-bottom":208,"padding-left":216,"padding-right":206,"padding-top":216,"position":136,"resize":1,"right":29,"stroke":1,"stroke-width":1,"table-layout":1,"text-align":66,"text-decoration":53,"text-indent":9,"text-overflow":8,"text-shadow":19,"text-transform":5,"top":71,"unicode-bidi":1,"vertical-align":37,"visibility":11,"white-space":24,"width":255,"word-wrap":6,"z-index":32,"zoom":10};WebInspector.CSSMetadata.prototype={startsWith:function(prefix)
5952 {var firstIndex=this._firstIndexOfPrefix(prefix);if(firstIndex===-1)
5953 return[];var results=[];while(firstIndex<this._values.length&&this._values[firstIndex].startsWith(prefix))
5954 results.push(this._values[firstIndex++]);return results;},mostUsedOf:function(properties)
5955 {var maxWeight=0;var index=0;for(var i=0;i<properties.length;i++){var weight=WebInspector.CSSMetadata.Weight[properties[i]];if(weight>maxWeight){maxWeight=weight;index=i;}}
5956 return index;},_firstIndexOfPrefix:function(prefix)
5957 {if(!this._values.length)
5958 return-1;if(!prefix)
5959 return 0;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;}
5960 if(this._values[middleIndex]<prefix)
5961 minIndex=middleIndex+1;else
5962 maxIndex=middleIndex-1;}while(minIndex<=maxIndex);if(foundIndex===undefined)
5963 return-1;while(foundIndex&&this._values[foundIndex-1].startsWith(prefix))
5964 foundIndex--;return foundIndex;},keySet:function()
5965 {if(!this._keySet)
5966 this._keySet=this._values.keySet();return this._keySet;},next:function(str,prefix)
5967 {return this._closest(str,prefix,1);},previous:function(str,prefix)
5968 {return this._closest(str,prefix,-1);},_closest:function(str,prefix,shift)
5969 {if(!str)
5970 return"";var index=this._values.indexOf(str);if(index===-1)
5971 return"";if(!prefix){index=(index+this._values.length+shift)%this._values.length;return this._values[index];}
5972 var propertiesWithPrefix=this.startsWith(prefix);var j=propertiesWithPrefix.indexOf(str);j=(j+propertiesWithPrefix.length+shift)%propertiesWithPrefix.length;return propertiesWithPrefix[j];},longhands:function(shorthand)
5973 {return this._longhands[shorthand];},shorthands:function(longhand)
5974 {return this._shorthands[longhand];}}
5975 WebInspector.StatusBarItem=function(element)
5976 {this.element=element;this._enabled=true;}
5977 WebInspector.StatusBarItem.prototype={setEnabled:function(value)
5978 {if(this._enabled===value)
5979 return;this._enabled=value;this._applyEnabledState();},_applyEnabledState:function()
5980 {this.element.disabled=!this._enabled;},__proto__:WebInspector.Object.prototype}
5981 WebInspector.StatusBarText=function(text,className)
5982 {WebInspector.StatusBarItem.call(this,document.createElement("span"));this.element.className="status-bar-item status-bar-text";if(className)
5983 this.element.classList.add(className);this.element.textContent=text;}
5984 WebInspector.StatusBarText.prototype={setText:function(text)
5985 {this.element.textContent=text;},__proto__:WebInspector.StatusBarItem.prototype}
5986 WebInspector.StatusBarButton=function(title,className,states)
5987 {WebInspector.StatusBarItem.call(this,document.createElement("button"));this.element.className=className+" status-bar-item";this.element.addEventListener("click",this._clicked.bind(this,false),false);this.glyph=document.createElement("div");this.glyph.className="glyph";this.element.appendChild(this.glyph);this.glyphShadow=document.createElement("div");this.glyphShadow.className="glyph shadow";this.element.appendChild(this.glyphShadow);this.states=states;if(!states)
5988 this.states=2;if(states==2)
5989 this._state=false;else
5990 this._state=0;this.title=title;this.className=className;this._visible=true;}
5991 WebInspector.StatusBarButton.prototype={_clicked:function(optionClick)
5992 {this.dispatchEventToListeners("click",optionClick);if(this._longClickInterval){clearInterval(this._longClickInterval);delete this._longClickInterval;}},_applyEnabledState:function()
5993 {this.element.disabled=!this._enabled;if(this._longClickInterval){clearInterval(this._longClickInterval);delete this._longClickInterval;}},enabled:function()
5994 {return this._enabled;},get title()
5995 {return this._title;},set title(x)
5996 {if(this._title===x)
5997 return;this._title=x;this.element.title=x;},get state()
5998 {return this._state;},set state(x)
5999 {if(this._state===x)
6000 return;if(this.states===2)
6001 this.element.enableStyleClass("toggled-on",x);else{this.element.classList.remove("toggled-"+this._state);if(x!==0)
6002 this.element.classList.add("toggled-"+x);}
6003 this._state=x;},get toggled()
6004 {if(this.states!==2)
6005 throw("Only used toggled when there are 2 states, otherwise, use state");return this.state;},set toggled(x)
6006 {if(this.states!==2)
6007 throw("Only used toggled when there are 2 states, otherwise, use state");this.state=x;},get visible()
6008 {return this._visible;},set visible(x)
6009 {if(this._visible===x)
6010 return;this.element.enableStyleClass("hidden",!x);this._visible=x;},makeLongClickEnabled:function()
6011 {var boundMouseDown=mouseDown.bind(this);var boundMouseUp=mouseUp.bind(this);this.element.addEventListener("mousedown",boundMouseDown,false);this.element.addEventListener("mouseout",boundMouseUp,false);this.element.addEventListener("mouseup",boundMouseUp,false);var longClicks=0;this._longClickData={mouseUp:boundMouseUp,mouseDown:boundMouseDown};function mouseDown(e)
6012 {if(e.which!==1)
6013 return;longClicks=0;this._longClickInterval=setInterval(longClicked.bind(this),200);}
6014 function mouseUp(e)
6015 {if(e.which!==1)
6016 return;if(this._longClickInterval){clearInterval(this._longClickInterval);delete this._longClickInterval;}}
6017 function longClicked()
6018 {++longClicks;this.dispatchEventToListeners(longClicks===1?"longClickDown":"longClickPress");}},unmakeLongClickEnabled:function()
6019 {if(!this._longClickData)
6020 return;this.element.removeEventListener("mousedown",this._longClickData.mouseDown,false);this.element.removeEventListener("mouseout",this._longClickData.mouseUp,false);this.element.removeEventListener("mouseup",this._longClickData.mouseUp,false);delete this._longClickData;},setLongClickOptionsEnabled:function(buttonsProvider)
6021 {if(buttonsProvider){if(!this._longClickOptionsData){this.makeLongClickEnabled();this.longClickGlyph=document.createElement("div");this.longClickGlyph.className="fill long-click-glyph";this.element.appendChild(this.longClickGlyph);this.longClickGlyphShadow=document.createElement("div");this.longClickGlyphShadow.className="fill long-click-glyph shadow";this.element.appendChild(this.longClickGlyphShadow);var longClickDownListener=this._showOptions.bind(this);this.addEventListener("longClickDown",longClickDownListener,this);this._longClickOptionsData={glyphElement:this.longClickGlyph,glyphShadowElement:this.longClickGlyphShadow,longClickDownListener:longClickDownListener};}
6022 this._longClickOptionsData.buttonsProvider=buttonsProvider;}else{if(!this._longClickOptionsData)
6023 return;this.element.removeChild(this._longClickOptionsData.glyphElement);this.element.removeChild(this._longClickOptionsData.glyphShadowElement);this.removeEventListener("longClickDown",this._longClickOptionsData.longClickDownListener,this);delete this._longClickOptionsData;this.unmakeLongClickEnabled();}},_showOptions:function()
6024 {var buttons=this._longClickOptionsData.buttonsProvider();var mainButtonClone=new WebInspector.StatusBarButton(this.title,this.className,this.states);mainButtonClone.addEventListener("click",this._clicked.bind(this,true),this);mainButtonClone.state=this.state;buttons.unshift(mainButtonClone);var mouseUpListener=mouseUp.bind(this);document.documentElement.addEventListener("mouseup",mouseUpListener,false);var optionsGlassPane=new WebInspector.GlassPane();var optionsBarElement=optionsGlassPane.element.createChild("div","alternate-status-bar-buttons-bar");const buttonHeight=23;var hostButtonPosition=this.element.totalOffset();var topNotBottom=hostButtonPosition.top+buttonHeight*buttons.length<document.documentElement.offsetHeight;if(!topNotBottom)
6025 buttons=buttons.reverse();optionsBarElement.style.height=(buttonHeight*buttons.length)+"px";if(topNotBottom)
6026 optionsBarElement.style.top=(hostButtonPosition.top+1)+"px";else
6027 optionsBarElement.style.top=(hostButtonPosition.top-(buttonHeight*(buttons.length-1)))+"px";optionsBarElement.style.left=(hostButtonPosition.left+1)+"px";var boundMouseOver=mouseOver.bind(this);var boundMouseOut=mouseOut.bind(this);for(var i=0;i<buttons.length;++i){buttons[i].element.addEventListener("mousemove",boundMouseOver,false);buttons[i].element.addEventListener("mouseout",boundMouseOut,false);optionsBarElement.appendChild(buttons[i].element);}
6028 var hostButtonIndex=topNotBottom?0:buttons.length-1;buttons[hostButtonIndex].element.classList.add("emulate-active");function mouseOver(e)
6029 {if(e.which!==1)
6030 return;var buttonElement=e.target.enclosingNodeOrSelfWithClass("status-bar-item");buttonElement.classList.add("emulate-active");}
6031 function mouseOut(e)
6032 {if(e.which!==1)
6033 return;var buttonElement=e.target.enclosingNodeOrSelfWithClass("status-bar-item");buttonElement.classList.remove("emulate-active");}
6034 function mouseUp(e)
6035 {if(e.which!==1)
6036 return;optionsGlassPane.dispose();document.documentElement.removeEventListener("mouseup",mouseUpListener,false);for(var i=0;i<buttons.length;++i){if(buttons[i].element.classList.contains("emulate-active")){buttons[i].element.classList.remove("emulate-active");buttons[i]._clicked(true);break;}}}},__proto__:WebInspector.StatusBarItem.prototype}
6037 WebInspector.StatusBarComboBox=function(changeHandler,className)
6038 {WebInspector.StatusBarItem.call(this,document.createElement("span"));this.element.className="status-bar-select-container";this._selectElement=this.element.createChild("select","status-bar-item");this.element.createChild("div","status-bar-select-arrow");if(changeHandler)
6039 this._selectElement.addEventListener("change",changeHandler,false);if(className)
6040 this._selectElement.classList.add(className);}
6041 WebInspector.StatusBarComboBox.prototype={selectElement:function()
6042 {return this._selectElement;},size:function()
6043 {return this._selectElement.childElementCount;},addOption:function(option)
6044 {this._selectElement.appendChild(option);},createOption:function(label,title,value)
6045 {var option=this._selectElement.createChild("option");option.text=label;if(title)
6046 option.title=title;if(typeof value!=="undefined")
6047 option.value=value;return option;},_applyEnabledState:function()
6048 {this._selectElement.disabled=!this._enabled;},removeOption:function(option)
6049 {this._selectElement.removeChild(option);},removeOptions:function()
6050 {this._selectElement.removeChildren();},selectedOption:function()
6051 {if(this._selectElement.selectedIndex>=0)
6052 return this._selectElement[this._selectElement.selectedIndex];return null;},select:function(option)
6053 {this._selectElement.selectedIndex=Array.prototype.indexOf.call(this._selectElement,option);},setSelectedIndex:function(index)
6054 {this._selectElement.selectedIndex=index;},selectedIndex:function()
6055 {return this._selectElement.selectedIndex;},__proto__:WebInspector.StatusBarItem.prototype}
6056 WebInspector.StatusBarCheckbox=function(title)
6057 {WebInspector.StatusBarItem.call(this,document.createElement("label"));this.element.classList.add("status-bar-item","checkbox");this._checkbox=this.element.createChild("input");this._checkbox.type="checkbox";this.element.createTextChild(title);}
6058 WebInspector.StatusBarCheckbox.prototype={checked:function()
6059 {return this._checkbox.checked;},__proto__:WebInspector.StatusBarItem.prototype}
6060 WebInspector.StatusBarStatesSettingButton=function(className,states,titles,currentStateSetting,lastStateSetting,stateChangedCallback)
6061 {WebInspector.StatusBarButton.call(this,"",className,states.length);var onClickBound=this._onClick.bind(this);this.addEventListener("click",onClickBound,this);this._states=states;this._buttons=[];for(var index=0;index<states.length;index++){var button=new WebInspector.StatusBarButton(titles[index],className,states.length);button.state=this._states[index];button.addEventListener("click",onClickBound,this);this._buttons.push(button);}
6062 this._currentStateSetting=currentStateSetting;this._lastStateSetting=lastStateSetting;this._stateChangedCallback=stateChangedCallback;this.setLongClickOptionsEnabled(this._createOptions.bind(this));this._currentState=null;this.toggleState(this._defaultState());}
6063 WebInspector.StatusBarStatesSettingButton.prototype={_onClick:function(e)
6064 {this.toggleState(e.target.state);},toggleState:function(state)
6065 {if(this._currentState===state)
6066 return;if(this._currentState)
6067 this._lastStateSetting.set(this._currentState);this._currentState=state;this._currentStateSetting.set(this._currentState);if(this._stateChangedCallback)
6068 this._stateChangedCallback(state);var defaultState=this._defaultState();this.state=defaultState;this.title=this._buttons[this._states.indexOf(defaultState)].title;},_defaultState:function()
6069 {if(!this._currentState){var state=this._currentStateSetting.get();return this._states.indexOf(state)>=0?state:this._states[0];}
6070 var lastState=this._lastStateSetting.get();if(lastState&&this._states.indexOf(lastState)>=0&&lastState!=this._currentState)
6071 return lastState;if(this._states.length>1&&this._currentState===this._states[0])
6072 return this._states[1];return this._states[0];},_createOptions:function()
6073 {var options=[];for(var index=0;index<this._states.length;index++){if(this._states[index]!==this.state&&this._states[index]!==this._currentState)
6074 options.push(this._buttons[index]);}
6075 return options;},__proto__:WebInspector.StatusBarButton.prototype}
6076 WebInspector.CompletionDictionary=function(){}
6077 WebInspector.CompletionDictionary.prototype={addWord:function(word){},removeWord:function(word){},hasWord:function(word){},wordsWithPrefix:function(prefix){},wordCount:function(word){}}
6078 WebInspector.SampleCompletionDictionary=function(){this._words={};}
6079 WebInspector.SampleCompletionDictionary.prototype={addWord:function(word)
6080 {if(!this._words[word])
6081 this._words[word]=1;else
6082 ++this._words[word];},removeWord:function(word)
6083 {if(!this._words[word])
6084 return;if(this._words[word]===1)
6085 delete this._words[word];else
6086 --this._words[word];},wordsWithPrefix:function(prefix)
6087 {var words=[];for(var i in this._words){if(i.startsWith(prefix))
6088 words.push(i);}
6089 return words;},hasWord:function(word)
6090 {return!!this._words[word];},wordCount:function(word)
6091 {return this._words[word]?this._words[word]:0;}}
6092 WebInspector.TextEditor=function(){};WebInspector.TextEditor.Events={GutterClick:"gutterClick"};WebInspector.TextEditor.GutterClickEventData;WebInspector.TextEditor.prototype={undo:function(){},redo:function(){},isClean:function(){},markClean:function(){},indent:function(){},cursorPositionToCoordinates:function(lineNumber,column){return null;},coordinatesToCursorPosition:function(x,y){return null;},tokenAtTextPosition:function(lineNumber,column){return null;},setMimeType:function(mimeType){},setReadOnly:function(readOnly){},readOnly:function(){},defaultFocusedElement:function(){},highlightRange:function(range,cssClass){},removeHighlight:function(highlightDescriptor){},revealLine:function(lineNumber){},addBreakpoint:function(lineNumber,disabled,conditional){},removeBreakpoint:function(lineNumber){},setExecutionLine:function(lineNumber){},clearExecutionLine:function(){},addDecoration:function(lineNumber,element){},removeDecoration:function(lineNumber,element){},highlightSearchResults:function(regex,range){},highlightPosition:function(lineNumber,columnNumber){},clearPositionHighlight:function(){},elementsToRestoreScrollPositionsFor:function(){},inheritScrollPositions:function(textEditor){},beginUpdates:function(){},endUpdates:function(){},onResize:function(){},editRange:function(range,text){},scrollToLine:function(lineNumber){},firstVisibleLine:function(){},lastVisibleLine:function(){},selection:function(){},lastSelection:function(){},setSelection:function(textRange){},copyRange:function(range){},setText:function(text){},text:function(){},range:function(){},line:function(lineNumber){},get linesCount(){},setAttribute:function(line,name,value){},getAttribute:function(line,name){},removeAttribute:function(line,name){},wasShown:function(){},willHide:function(){},setCompletionDictionary:function(dictionary){},textEditorPositionHandle:function(lineNumber,columnNumber){}}
6093 WebInspector.TextEditorPositionHandle=function()
6094 {}
6095 WebInspector.TextEditorPositionHandle.prototype={resolve:function(){},equal:function(positionHandle){}}
6096 WebInspector.TextEditorDelegate=function()
6097 {}
6098 WebInspector.TextEditorDelegate.prototype={onTextChanged:function(oldRange,newRange){},selectionChanged:function(textRange){},scrollChanged:function(lineNumber){},editorFocused:function(){},populateLineGutterContextMenu:function(contextMenu,lineNumber){},populateTextAreaContextMenu:function(contextMenu,lineNumber){},createLink:function(hrefValue,isExternal){},onJumpToPosition:function(from,to){}}
6099 WebInspector.SourceFrame=function(contentProvider)
6100 {WebInspector.View.call(this);this.element.classList.add("script-view");this.element.classList.add("fill");this._url=contentProvider.contentURL();this._contentProvider=contentProvider;var textEditorDelegate=new WebInspector.TextEditorDelegateForSourceFrame(this);loadScript("CodeMirrorTextEditor.js");this._textEditor=new WebInspector.CodeMirrorTextEditor(this._url,textEditorDelegate);this._currentSearchResultIndex=-1;this._searchResults=[];this._messages=[];this._rowMessages={};this._messageBubbles={};this._textEditor.setReadOnly(!this.canEditSource());this._shortcuts={};this.addShortcut(WebInspector.KeyboardShortcut.makeKey("s",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta),this._commitEditing.bind(this));this.element.addEventListener("keydown",this._handleKeyDown.bind(this),false);this._sourcePosition=new WebInspector.StatusBarText("","source-frame-cursor-position");}
6101 WebInspector.SourceFrame.createSearchRegex=function(query,modifiers)
6102 {var regex;modifiers=modifiers||"";try{if(/^\/.+\/$/.test(query)){regex=new RegExp(query.substring(1,query.length-1),modifiers);regex.__fromRegExpQuery=true;}}catch(e){}
6103 if(!regex)
6104 regex=createPlainTextSearchRegex(query,"i"+modifiers);return regex;}
6105 WebInspector.SourceFrame.Events={ScrollChanged:"ScrollChanged",SelectionChanged:"SelectionChanged",JumpHappened:"JumpHappened"}
6106 WebInspector.SourceFrame.prototype={addShortcut:function(key,handler)
6107 {this._shortcuts[key]=handler;},wasShown:function()
6108 {this._ensureContentLoaded();this._textEditor.show(this.element);this._editorAttached=true;this._wasShownOrLoaded();},_isEditorShowing:function()
6109 {return this.isShowing()&&this._editorAttached;},willHide:function()
6110 {WebInspector.View.prototype.willHide.call(this);this._clearPositionHighlight();this._clearLineToReveal();},statusBarText:function()
6111 {return this._sourcePosition.element;},statusBarItems:function()
6112 {return[];},defaultFocusedElement:function()
6113 {return this._textEditor.defaultFocusedElement();},get loaded()
6114 {return this._loaded;},hasContent:function()
6115 {return true;},get textEditor()
6116 {return this._textEditor;},_ensureContentLoaded:function()
6117 {if(!this._contentRequested){this._contentRequested=true;this._contentProvider.requestContent(this.setContent.bind(this));}},addMessage:function(msg)
6118 {this._messages.push(msg);if(this.loaded)
6119 this.addMessageToSource(msg.line-1,msg);},clearMessages:function()
6120 {for(var line in this._messageBubbles){var bubble=this._messageBubbles[line];var lineNumber=parseInt(line,10);this._textEditor.removeDecoration(lineNumber,bubble);}
6121 this._messages=[];this._rowMessages={};this._messageBubbles={};},canHighlightPosition:function()
6122 {return true;},highlightPosition:function(line,column)
6123 {this._clearLineToReveal();this._clearLineToScrollTo();this._clearSelectionToSet();this._positionToHighlight={line:line,column:column};this._innerHighlightPositionIfNeeded();},_innerHighlightPositionIfNeeded:function()
6124 {if(!this._positionToHighlight)
6125 return;if(!this.loaded||!this._isEditorShowing())
6126 return;this._textEditor.highlightPosition(this._positionToHighlight.line,this._positionToHighlight.column);delete this._positionToHighlight;},_clearPositionHighlight:function()
6127 {this._textEditor.clearPositionHighlight();delete this._positionToHighlight;},revealLine:function(line)
6128 {this._clearPositionHighlight();this._clearLineToScrollTo();this._clearSelectionToSet();this._lineToReveal=line;this._innerRevealLineIfNeeded();},_innerRevealLineIfNeeded:function()
6129 {if(typeof this._lineToReveal==="number"){if(this.loaded&&this._isEditorShowing()){this._textEditor.revealLine(this._lineToReveal);delete this._lineToReveal;}}},_clearLineToReveal:function()
6130 {delete this._lineToReveal;},scrollToLine:function(line)
6131 {this._clearPositionHighlight();this._clearLineToReveal();this._lineToScrollTo=line;this._innerScrollToLineIfNeeded();},_innerScrollToLineIfNeeded:function()
6132 {if(typeof this._lineToScrollTo==="number"){if(this.loaded&&this._isEditorShowing()){this._textEditor.scrollToLine(this._lineToScrollTo);delete this._lineToScrollTo;}}},_clearLineToScrollTo:function()
6133 {delete this._lineToScrollTo;},setSelection:function(textRange)
6134 {this._selectionToSet=textRange;this._innerSetSelectionIfNeeded();},_innerSetSelectionIfNeeded:function()
6135 {if(this._selectionToSet&&this.loaded&&this._isEditorShowing()){this._textEditor.setSelection(this._selectionToSet);delete this._selectionToSet;}},_clearSelectionToSet:function()
6136 {delete this._selectionToSet;},_wasShownOrLoaded:function()
6137 {this._innerHighlightPositionIfNeeded();this._innerRevealLineIfNeeded();this._innerSetSelectionIfNeeded();this._innerScrollToLineIfNeeded();},onTextChanged:function(oldRange,newRange)
6138 {if(this._searchResultsChangedCallback&&!this._isReplacing)
6139 this._searchResultsChangedCallback();this.clearMessages();},_simplifyMimeType:function(content,mimeType)
6140 {if(!mimeType)
6141 return"";if(mimeType.indexOf("javascript")>=0||mimeType.indexOf("jscript")>=0||mimeType.indexOf("ecmascript")>=0)
6142 return"text/javascript";if(mimeType==="text/x-php"&&content.match(/\<\?.*\?\>/g))
6143 return"application/x-httpd-php";return mimeType;},setHighlighterType:function(highlighterType)
6144 {this._highlighterType=highlighterType;this._updateHighlighterType("");},_updateHighlighterType:function(content)
6145 {this._textEditor.setMimeType(this._simplifyMimeType(content,this._highlighterType));},setContent:function(content)
6146 {if(!this._loaded){this._loaded=true;this._textEditor.setText(content||"");this._textEditor.markClean();}else{var firstLine=this._textEditor.firstVisibleLine();var selection=this._textEditor.selection();this._textEditor.setText(content||"");this._textEditor.scrollToLine(firstLine);this._textEditor.setSelection(selection);}
6147 this._updateHighlighterType(content||"");this._textEditor.beginUpdates();this._setTextEditorDecorations();this._wasShownOrLoaded();if(this._delayedFindSearchMatches){this._delayedFindSearchMatches();delete this._delayedFindSearchMatches;}
6148 this.onTextEditorContentLoaded();this._textEditor.endUpdates();},onTextEditorContentLoaded:function(){},_setTextEditorDecorations:function()
6149 {this._rowMessages={};this._messageBubbles={};this._textEditor.beginUpdates();this._addExistingMessagesToSource();this._textEditor.endUpdates();},performSearch:function(query,shouldJump,callback,currentMatchChangedCallback,searchResultsChangedCallback)
6150 {function doFindSearchMatches(query)
6151 {this._currentSearchResultIndex=-1;this._searchResults=[];var regex=WebInspector.SourceFrame.createSearchRegex(query);this._searchRegex=regex;this._searchResults=this._collectRegexMatches(regex);if(!this._searchResults.length)
6152 this._textEditor.cancelSearchResultsHighlight();else if(shouldJump)
6153 this.jumpToNextSearchResult();else
6154 this._textEditor.highlightSearchResults(regex,null);callback(this,this._searchResults.length);}
6155 this._resetSearch();this._currentSearchMatchChangedCallback=currentMatchChangedCallback;this._searchResultsChangedCallback=searchResultsChangedCallback;if(this.loaded)
6156 doFindSearchMatches.call(this,query);else
6157 this._delayedFindSearchMatches=doFindSearchMatches.bind(this,query);this._ensureContentLoaded();},_editorFocused:function()
6158 {if(!this._searchResults.length)
6159 return;this._currentSearchResultIndex=-1;if(this._currentSearchMatchChangedCallback)
6160 this._currentSearchMatchChangedCallback(this._currentSearchResultIndex);this._textEditor.highlightSearchResults(this._searchRegex,null);},_searchResultAfterSelectionIndex:function(selection)
6161 {if(!selection)
6162 return 0;for(var i=0;i<this._searchResults.length;++i){if(this._searchResults[i].compareTo(selection)>=0)
6163 return i;}
6164 return 0;},_resetSearch:function()
6165 {delete this._delayedFindSearchMatches;delete this._currentSearchMatchChangedCallback;delete this._searchResultsChangedCallback;this._currentSearchResultIndex=-1;this._searchResults=[];delete this._searchRegex;},searchCanceled:function()
6166 {var range=this._currentSearchResultIndex!==-1?this._searchResults[this._currentSearchResultIndex]:null;this._resetSearch();if(!this.loaded)
6167 return;this._textEditor.cancelSearchResultsHighlight();if(range)
6168 this._textEditor.setSelection(range);},hasSearchResults:function()
6169 {return this._searchResults.length>0;},jumpToFirstSearchResult:function()
6170 {this.jumpToSearchResult(0);},jumpToLastSearchResult:function()
6171 {this.jumpToSearchResult(this._searchResults.length-1);},jumpToNextSearchResult:function()
6172 {var currentIndex=this._searchResultAfterSelectionIndex(this._textEditor.selection());var nextIndex=this._currentSearchResultIndex===-1?currentIndex:currentIndex+1;this.jumpToSearchResult(nextIndex);},jumpToPreviousSearchResult:function()
6173 {var currentIndex=this._searchResultAfterSelectionIndex(this._textEditor.selection());this.jumpToSearchResult(currentIndex-1);},showingFirstSearchResult:function()
6174 {return this._searchResults.length&&this._currentSearchResultIndex===0;},showingLastSearchResult:function()
6175 {return this._searchResults.length&&this._currentSearchResultIndex===(this._searchResults.length-1);},get currentSearchResultIndex()
6176 {return this._currentSearchResultIndex;},jumpToSearchResult:function(index)
6177 {if(!this.loaded||!this._searchResults.length)
6178 return;this._currentSearchResultIndex=(index+this._searchResults.length)%this._searchResults.length;if(this._currentSearchMatchChangedCallback)
6179 this._currentSearchMatchChangedCallback(this._currentSearchResultIndex);this._textEditor.highlightSearchResults(this._searchRegex,this._searchResults[this._currentSearchResultIndex]);},replaceSelectionWith:function(text)
6180 {var range=this._searchResults[this._currentSearchResultIndex];if(!range)
6181 return;this._textEditor.highlightSearchResults(this._searchRegex,null);this._isReplacing=true;var newRange=this._textEditor.editRange(range,text);delete this._isReplacing;this._textEditor.setSelection(newRange.collapseToEnd());},replaceAllWith:function(query,replacement)
6182 {this._textEditor.highlightSearchResults(this._searchRegex,null);var text=this._textEditor.text();var range=this._textEditor.range();var regex=WebInspector.SourceFrame.createSearchRegex(query,"g");if(regex.__fromRegExpQuery)
6183 text=text.replace(regex,replacement);else
6184 text=text.replace(regex,function(){return replacement;});this._isReplacing=true;this._textEditor.editRange(range,text);delete this._isReplacing;},_collectRegexMatches:function(regexObject)
6185 {var ranges=[];for(var i=0;i<this._textEditor.linesCount;++i){var line=this._textEditor.line(i);var offset=0;do{var match=regexObject.exec(line);if(match){if(match[0].length)
6186 ranges.push(new WebInspector.TextRange(i,offset+match.index,i,offset+match.index+match[0].length));offset+=match.index+1;line=line.substring(match.index+1);}}while(match&&line);}
6187 return ranges;},_addExistingMessagesToSource:function()
6188 {var length=this._messages.length;for(var i=0;i<length;++i)
6189 this.addMessageToSource(this._messages[i].line-1,this._messages[i]);},addMessageToSource:function(lineNumber,msg)
6190 {if(lineNumber>=this._textEditor.linesCount)
6191 lineNumber=this._textEditor.linesCount-1;if(lineNumber<0)
6192 lineNumber=0;var rowMessages=this._rowMessages[lineNumber];if(!rowMessages){rowMessages=[];this._rowMessages[lineNumber]=rowMessages;}
6193 for(var i=0;i<rowMessages.length;++i){if(rowMessages[i].consoleMessage.isEqual(msg)){rowMessages[i].repeatCount=msg.totalRepeatCount;this._updateMessageRepeatCount(rowMessages[i]);return;}}
6194 var rowMessage={consoleMessage:msg};rowMessages.push(rowMessage);this._textEditor.beginUpdates();var messageBubbleElement=this._messageBubbles[lineNumber];if(!messageBubbleElement){messageBubbleElement=document.createElement("div");messageBubbleElement.className="webkit-html-message-bubble";this._messageBubbles[lineNumber]=messageBubbleElement;this._textEditor.addDecoration(lineNumber,messageBubbleElement);}
6195 var imageElement=document.createElement("div");switch(msg.level){case WebInspector.ConsoleMessage.MessageLevel.Error:messageBubbleElement.classList.add("webkit-html-error-message");imageElement.className="error-icon-small";break;case WebInspector.ConsoleMessage.MessageLevel.Warning:messageBubbleElement.classList.add("webkit-html-warning-message");imageElement.className="warning-icon-small";break;}
6196 var messageLineElement=document.createElement("div");messageLineElement.className="webkit-html-message-line";messageBubbleElement.appendChild(messageLineElement);messageLineElement.appendChild(imageElement);messageLineElement.appendChild(document.createTextNode(msg.message));rowMessage.element=messageLineElement;rowMessage.repeatCount=msg.totalRepeatCount;this._updateMessageRepeatCount(rowMessage);this._textEditor.endUpdates();},_updateMessageRepeatCount:function(rowMessage)
6197 {if(rowMessage.repeatCount<2)
6198 return;if(!rowMessage.repeatCountElement){var repeatCountElement=document.createElement("span");rowMessage.element.appendChild(repeatCountElement);rowMessage.repeatCountElement=repeatCountElement;}
6199 rowMessage.repeatCountElement.textContent=WebInspector.UIString(" (repeated %d times)",rowMessage.repeatCount);},removeMessageFromSource:function(lineNumber,msg)
6200 {if(lineNumber>=this._textEditor.linesCount)
6201 lineNumber=this._textEditor.linesCount-1;if(lineNumber<0)
6202 lineNumber=0;var rowMessages=this._rowMessages[lineNumber];for(var i=0;rowMessages&&i<rowMessages.length;++i){var rowMessage=rowMessages[i];if(rowMessage.consoleMessage!==msg)
6203 continue;var messageLineElement=rowMessage.element;var messageBubbleElement=messageLineElement.parentElement;messageBubbleElement.removeChild(messageLineElement);rowMessages.remove(rowMessage);if(!rowMessages.length)
6204 delete this._rowMessages[lineNumber];if(!messageBubbleElement.childElementCount){this._textEditor.removeDecoration(lineNumber,messageBubbleElement);delete this._messageBubbles[lineNumber];}
6205 break;}},populateLineGutterContextMenu:function(contextMenu,lineNumber)
6206 {},populateTextAreaContextMenu:function(contextMenu,lineNumber)
6207 {},onJumpToPosition:function(from,to)
6208 {this.dispatchEventToListeners(WebInspector.SourceFrame.Events.JumpHappened,{from:from,to:to});},inheritScrollPositions:function(sourceFrame)
6209 {this._textEditor.inheritScrollPositions(sourceFrame._textEditor);},canEditSource:function()
6210 {return false;},commitEditing:function(text)
6211 {},selectionChanged:function(textRange)
6212 {this._updateSourcePosition(textRange);this.dispatchEventToListeners(WebInspector.SourceFrame.Events.SelectionChanged,textRange);WebInspector.notifications.dispatchEventToListeners(WebInspector.SourceFrame.Events.SelectionChanged,textRange);},_updateSourcePosition:function(textRange)
6213 {if(!textRange)
6214 return;if(textRange.isEmpty()){this._sourcePosition.setText(WebInspector.UIString("Line %d, Column %d",textRange.endLine+1,textRange.endColumn+1));return;}
6215 textRange=textRange.normalize();var selectedText=this._textEditor.copyRange(textRange);if(textRange.startLine===textRange.endLine)
6216 this._sourcePosition.setText(WebInspector.UIString("%d characters selected",selectedText.length));else
6217 this._sourcePosition.setText(WebInspector.UIString("%d lines, %d characters selected",textRange.endLine-textRange.startLine+1,selectedText.length));},scrollChanged:function(lineNumber)
6218 {this.dispatchEventToListeners(WebInspector.SourceFrame.Events.ScrollChanged,lineNumber);},_handleKeyDown:function(e)
6219 {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(e);var handler=this._shortcuts[shortcutKey];if(handler&&handler())
6220 e.consume(true);},_commitEditing:function()
6221 {if(this._textEditor.readOnly())
6222 return false;var content=this._textEditor.text();this.commitEditing(content);return true;},__proto__:WebInspector.View.prototype}
6223 WebInspector.TextEditorDelegateForSourceFrame=function(sourceFrame)
6224 {this._sourceFrame=sourceFrame;}
6225 WebInspector.TextEditorDelegateForSourceFrame.prototype={onTextChanged:function(oldRange,newRange)
6226 {this._sourceFrame.onTextChanged(oldRange,newRange);},selectionChanged:function(textRange)
6227 {this._sourceFrame.selectionChanged(textRange);},scrollChanged:function(lineNumber)
6228 {this._sourceFrame.scrollChanged(lineNumber);},editorFocused:function()
6229 {this._sourceFrame._editorFocused();},populateLineGutterContextMenu:function(contextMenu,lineNumber)
6230 {this._sourceFrame.populateLineGutterContextMenu(contextMenu,lineNumber);},populateTextAreaContextMenu:function(contextMenu,lineNumber)
6231 {this._sourceFrame.populateTextAreaContextMenu(contextMenu,lineNumber);},createLink:function(hrefValue,isExternal)
6232 {var targetLocation=WebInspector.ParsedURL.completeURL(this._sourceFrame._url,hrefValue);return WebInspector.linkifyURLAsNode(targetLocation||hrefValue,hrefValue,undefined,isExternal);},onJumpToPosition:function(from,to)
6233 {this._sourceFrame.onJumpToPosition(from,to);}}
6234 WebInspector.ResourceView=function(resource)
6235 {WebInspector.View.call(this);this.registerRequiredCSS("resourceView.css");this.element.classList.add("resource-view");this.resource=resource;}
6236 WebInspector.ResourceView.prototype={hasContent:function()
6237 {return false;},__proto__:WebInspector.View.prototype}
6238 WebInspector.ResourceView.hasTextContent=function(resource)
6239 {if(resource.type.isTextType())
6240 return true;if(resource.type===WebInspector.resourceTypes.Other)
6241 return!!resource.content&&!resource.contentEncoded;return false;}
6242 WebInspector.ResourceView.nonSourceViewForResource=function(resource)
6243 {switch(resource.type){case WebInspector.resourceTypes.Image:return new WebInspector.ImageView(resource);case WebInspector.resourceTypes.Font:return new WebInspector.FontView(resource);default:return new WebInspector.ResourceView(resource);}}
6244 WebInspector.ResourceSourceFrame=function(resource)
6245 {this._resource=resource;WebInspector.SourceFrame.call(this,resource);}
6246 WebInspector.ResourceSourceFrame.prototype={get resource()
6247 {return this._resource;},populateTextAreaContextMenu:function(contextMenu,lineNumber)
6248 {contextMenu.appendApplicableItems(this._resource);},__proto__:WebInspector.SourceFrame.prototype}
6249 WebInspector.ResourceSourceFrameFallback=function(resource)
6250 {WebInspector.View.call(this);this._resource=resource;this.element.classList.add("fill");this.element.classList.add("script-view");this._content=this.element.createChild("div","script-view-fallback monospace");}
6251 WebInspector.ResourceSourceFrameFallback.prototype={wasShown:function()
6252 {if(!this._contentRequested){this._contentRequested=true;this._resource.requestContent(this._contentLoaded.bind(this));}},_contentLoaded:function(content)
6253 {this._content.textContent=content;},__proto__:WebInspector.View.prototype}
6254 WebInspector.FontView=function(resource)
6255 {WebInspector.ResourceView.call(this,resource);this.element.classList.add("font");}
6256 WebInspector.FontView._fontPreviewLines=["ABCDEFGHIJKLM","NOPQRSTUVWXYZ","abcdefghijklm","nopqrstuvwxyz","1234567890"];WebInspector.FontView._fontId=0;WebInspector.FontView._measureFontSize=50;WebInspector.FontView.prototype={hasContent:function()
6257 {return true;},_createContentIfNeeded:function()
6258 {if(this.fontPreviewElement)
6259 return;var uniqueFontName="WebInspectorFontPreview"+(++WebInspector.FontView._fontId);this.fontStyleElement=document.createElement("style");this.fontStyleElement.textContent="@font-face { font-family: \""+uniqueFontName+"\"; src: url("+this.resource.url+"); }";document.head.appendChild(this.fontStyleElement);var fontPreview=document.createElement("div");for(var i=0;i<WebInspector.FontView._fontPreviewLines.length;++i){if(i>0)
6260 fontPreview.appendChild(document.createElement("br"));fontPreview.appendChild(document.createTextNode(WebInspector.FontView._fontPreviewLines[i]));}
6261 this.fontPreviewElement=fontPreview.cloneNode(true);this.fontPreviewElement.style.setProperty("font-family",uniqueFontName);this.fontPreviewElement.style.setProperty("visibility","hidden");this._dummyElement=fontPreview;this._dummyElement.style.visibility="hidden";this._dummyElement.style.zIndex="-1";this._dummyElement.style.display="inline";this._dummyElement.style.position="absolute";this._dummyElement.style.setProperty("font-family",uniqueFontName);this._dummyElement.style.setProperty("font-size",WebInspector.FontView._measureFontSize+"px");this.element.appendChild(this.fontPreviewElement);},wasShown:function()
6262 {this._createContentIfNeeded();this.updateFontPreviewSize();},onResize:function()
6263 {if(this._inResize)
6264 return;this._inResize=true;try{this.updateFontPreviewSize();}finally{delete this._inResize;}},_measureElement:function()
6265 {this.element.appendChild(this._dummyElement);var result={width:this._dummyElement.offsetWidth,height:this._dummyElement.offsetHeight};this.element.removeChild(this._dummyElement);return result;},updateFontPreviewSize:function()
6266 {if(!this.fontPreviewElement||!this.isShowing())
6267 return;this.fontPreviewElement.style.removeProperty("visibility");var dimension=this._measureElement();const height=dimension.height;const width=dimension.width;const containerWidth=this.element.offsetWidth-50;const containerHeight=this.element.offsetHeight-30;if(!height||!width||!containerWidth||!containerHeight){this.fontPreviewElement.style.removeProperty("font-size");return;}
6268 var widthRatio=containerWidth/width;var heightRatio=containerHeight/height;var finalFontSize=Math.floor(WebInspector.FontView._measureFontSize*Math.min(widthRatio,heightRatio))-2;this.fontPreviewElement.style.setProperty("font-size",finalFontSize+"px",null);},__proto__:WebInspector.ResourceView.prototype}
6269 WebInspector.ImageView=function(resource)
6270 {WebInspector.ResourceView.call(this,resource);this.element.classList.add("image");}
6271 WebInspector.ImageView.prototype={hasContent:function()
6272 {return true;},wasShown:function()
6273 {this._createContentIfNeeded();},_createContentIfNeeded:function()
6274 {if(this._container)
6275 return;var imageContainer=document.createElement("div");imageContainer.className="image";this.element.appendChild(imageContainer);var imagePreviewElement=document.createElement("img");imagePreviewElement.classList.add("resource-image-view");imageContainer.appendChild(imagePreviewElement);imagePreviewElement.addEventListener("contextmenu",this._contextMenu.bind(this),true);this._container=document.createElement("div");this._container.className="info";this.element.appendChild(this._container);var imageNameElement=document.createElement("h1");imageNameElement.className="title";imageNameElement.textContent=this.resource.displayName;this._container.appendChild(imageNameElement);var infoListElement=document.createElement("dl");infoListElement.className="infoList";this.resource.populateImageSource(imagePreviewElement);function onImageLoad()
6276 {var content=this.resource.content;if(content)
6277 var resourceSize=this._base64ToSize(content);else
6278 var resourceSize=this.resource.resourceSize;var imageProperties=[{name:WebInspector.UIString("Dimensions"),value:WebInspector.UIString("%d Ã— %d",imagePreviewElement.naturalWidth,imagePreviewElement.naturalHeight)},{name:WebInspector.UIString("File size"),value:Number.bytesToString(resourceSize)},{name:WebInspector.UIString("MIME type"),value:this.resource.mimeType}];infoListElement.removeChildren();for(var i=0;i<imageProperties.length;++i){var dt=document.createElement("dt");dt.textContent=imageProperties[i].name;infoListElement.appendChild(dt);var dd=document.createElement("dd");dd.textContent=imageProperties[i].value;infoListElement.appendChild(dd);}
6279 var dt=document.createElement("dt");dt.textContent=WebInspector.UIString("URL");infoListElement.appendChild(dt);var dd=document.createElement("dd");var externalResource=true;dd.appendChild(WebInspector.linkifyURLAsNode(this.resource.url,undefined,undefined,externalResource));infoListElement.appendChild(dd);this._container.appendChild(infoListElement);}
6280 imagePreviewElement.addEventListener("load",onImageLoad.bind(this),false);this._imagePreviewElement=imagePreviewElement;},_base64ToSize:function(content)
6281 {if(!content.length)
6282 return 0;var size=(content.length||0)*3/4;if(content.length>0&&content[content.length-1]==="=")
6283 size--;if(content.length>1&&content[content.length-2]==="=")
6284 size--;return size;},_contextMenu:function(event)
6285 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy image URL":"Copy Image URL"),this._copyImageURL.bind(this));if(this._imagePreviewElement.src)
6286 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy image as Data URL":"Copy Image As Data URL"),this._copyImageAsDataURL.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Open image in new tab":"Open Image in New Tab"),this._openInNewTab.bind(this));contextMenu.show();},_copyImageAsDataURL:function()
6287 {InspectorFrontendHost.copyText(this._imagePreviewElement.src);},_copyImageURL:function()
6288 {InspectorFrontendHost.copyText(this.resource.url);},_openInNewTab:function()
6289 {InspectorFrontendHost.openInNewTab(this.resource.url);},__proto__:WebInspector.ResourceView.prototype}
6290 WebInspector.SplitView=function(isVertical,sidebarSizeSettingName,defaultSidebarWidth,defaultSidebarHeight)
6291 {WebInspector.View.call(this);this.registerRequiredCSS("splitView.css");this.element.classList.add("split-view");this.element.classList.add("fill");this._firstElement=this.element.createChild("div","split-view-contents scroll-target split-view-contents-first");this._secondElement=this.element.createChild("div","split-view-contents scroll-target split-view-contents-second");this._resizerElement=this.element.createChild("div","split-view-resizer");this._onDragStartBound=this._onDragStart.bind(this);this._resizerElements=[];this._resizable=true;this._savedSidebarWidth=defaultSidebarWidth||200;this._savedSidebarHeight=defaultSidebarHeight||this._savedSidebarWidth;if(0<this._savedSidebarWidth&&this._savedSidebarWidth<1&&0<this._savedSidebarHeight&&this._savedSidebarHeight<1)
6292 this._useFraction=true;this._sidebarSizeSettingName=sidebarSizeSettingName;this.setSecondIsSidebar(true);this._innerSetVertical(isVertical);this.installResizer(this._resizerElement);}
6293 WebInspector.SplitView.prototype={isVertical:function()
6294 {return this._isVertical;},setVertical:function(isVertical)
6295 {if(this._isVertical===isVertical)
6296 return;this._innerSetVertical(isVertical);if(this.isShowing())
6297 this._updateLayout();for(var i=0;i<this._resizerElements.length;++i)
6298 this._resizerElements[i].style.setProperty("cursor",this._isVertical?"ew-resize":"ns-resize");},_innerSetVertical:function(isVertical)
6299 {this.element.classList.remove(this._isVertical?"hbox":"vbox");this._isVertical=isVertical;this.element.classList.add(this._isVertical?"hbox":"vbox");delete this._resizerElementSize;this._sidebarSize=-1;},_updateLayout:function()
6300 {delete this._totalSize;this._innerSetSidebarSize(this._lastSidebarSize());},setFirstView:function(view)
6301 {if(this._firstView)
6302 this._firstView.detach();this._firstView=view;view.show(this._firstElement);},setSecondView:function(view)
6303 {if(this._secondView)
6304 this._secondView.detach();this._secondView=view;view.show(this._secondElement);},setMainView:function(view)
6305 {if(this.isSidebarSecond())
6306 this.setFirstView(view);else
6307 this.setSecondView(view);},setSidebarView:function(view)
6308 {if(this.isSidebarSecond())
6309 this.setSecondView(view);else
6310 this.setFirstView(view);},firstElement:function()
6311 {return this._firstElement;},secondElement:function()
6312 {return this._secondElement;},mainElement:function()
6313 {return this.isSidebarSecond()?this.firstElement():this.secondElement();},sidebarElement:function()
6314 {return this.isSidebarSecond()?this.secondElement():this.firstElement();},isSidebarSecond:function()
6315 {return this._secondIsSidebar;},setSecondIsSidebar:function(secondIsSidebar)
6316 {this.sidebarElement().classList.remove("split-view-sidebar");this.mainElement().classList.remove("split-view-main");this._secondIsSidebar=secondIsSidebar;this.sidebarElement().classList.add("split-view-sidebar");this.mainElement().classList.add("split-view-main");},resizerElement:function()
6317 {return this._resizerElement;},showOnlyFirst:function()
6318 {this._showOnly(this._firstElement,this._secondElement);if(this._firstView)
6319 this._firstView.show(this._firstElement);if(this._secondView)
6320 this._secondView.detach();this.doResize();},showOnlySecond:function()
6321 {this._showOnly(this._secondElement,this._firstElement);if(this._firstView)
6322 this._firstView.detach();if(this._secondView)
6323 this._secondView.show(this._secondElement);this.doResize();},_showOnly:function(sideA,sideB)
6324 {sideA.classList.remove("hidden");sideA.classList.add("maximized");sideB.classList.add("hidden");sideB.classList.remove("maximized");this._removeAllLayoutProperties();this._isShowingOne=true;this._sidebarSize=-1;this.setResizable(false);},_removeAllLayoutProperties:function()
6325 {this.sidebarElement().style.removeProperty("flexBasis");this._resizerElement.style.removeProperty("left");this._resizerElement.style.removeProperty("right");this._resizerElement.style.removeProperty("top");this._resizerElement.style.removeProperty("bottom");this._resizerElement.style.removeProperty("margin-left");this._resizerElement.style.removeProperty("margin-right");this._resizerElement.style.removeProperty("margin-top");this._resizerElement.style.removeProperty("margin-bottom");},showBoth:function()
6326 {this._firstElement.classList.remove("hidden");this._firstElement.classList.remove("maximized");this._secondElement.classList.remove("hidden");this._secondElement.classList.remove("maximized");if(this._firstView)
6327 this._firstView.show(this._firstElement);if(this._secondView)
6328 this._secondView.show(this._secondElement);this._isShowingOne=false;this._sidebarSize=-1;this.setResizable(true);this.doResize();},setResizable:function(resizable)
6329 {this._resizable=resizable;this._resizerElement.enableStyleClass("hidden",!resizable);},setSidebarSize:function(size,ignoreConstraints)
6330 {this._innerSetSidebarSize(size,ignoreConstraints);this._saveSidebarSize();},sidebarSize:function()
6331 {return Math.max(0,this._sidebarSize);},totalSize:function()
6332 {if(!this._totalSize)
6333 this._totalSize=this._isVertical?this.element.offsetWidth:this.element.offsetHeight;return this._totalSize;},_innerSetSidebarSize:function(size,ignoreConstraints)
6334 {if(this._isShowingOne){this._sidebarSize=size;return;}
6335 if(!ignoreConstraints)
6336 size=this._applyConstraints(size);if(this._sidebarSize===size)
6337 return;if(size<0){return;}
6338 this._removeAllLayoutProperties();var sizeValue;if(this._useFraction)
6339 sizeValue=(size/this.totalSize())*100+"%";else
6340 sizeValue=size+"px";if(!this._resizerElementSize)
6341 this._resizerElementSize=this._isVertical?this._resizerElement.offsetWidth:this._resizerElement.offsetHeight;this.sidebarElement().style.flexBasis=sizeValue;if(this._isVertical){if(this._secondIsSidebar){this._resizerElement.style.right=sizeValue;this._resizerElement.style.marginRight=-this._resizerElementSize/2+"px";}else{this._resizerElement.style.left=sizeValue;this._resizerElement.style.marginLeft=-this._resizerElementSize/2+"px";}}else{if(this._secondIsSidebar){this._resizerElement.style.bottom=sizeValue;this._resizerElement.style.marginBottom=-this._resizerElementSize/2+"px";}else{this._resizerElement.style.top=sizeValue;this._resizerElement.style.marginTop=-this._resizerElementSize/2+"px";}}
6342 this._sidebarSize=size;this._muteOnResize=true;this.doResize();delete this._muteOnResize;},setSidebarElementConstraints:function(minWidth,minHeight)
6343 {if(typeof minWidth==="number")
6344 this._minimumSidebarWidth=minWidth;if(typeof minHeight==="number")
6345 this._minimumSidebarHeight=minHeight;},setMainElementConstraints:function(minWidth,minHeight)
6346 {if(typeof minWidth==="number")
6347 this._minimumMainWidth=minWidth;if(typeof minHeight==="number")
6348 this._minimumMainHeight=minHeight;},_applyConstraints:function(sidebarSize)
6349 {const minPadding=20;var totalSize=this.totalSize();var minimumSiderbarSizeContraint=this.isVertical()?this._minimumSidebarWidth:this._minimumSidebarHeight;var from=minimumSiderbarSizeContraint||0;var fromInPercents=false;if(from&&from<1){fromInPercents=true;from=Math.round(totalSize*from);}
6350 if(typeof minimumSiderbarSizeContraint!=="number")
6351 from=Math.max(from,minPadding);var minimumMainSizeConstraint=this.isVertical()?this._minimumMainWidth:this._minimumMainHeight;var minMainSize=minimumMainSizeConstraint||0;var toInPercents=false;if(minMainSize&&minMainSize<1){toInPercents=true;minMainSize=Math.round(totalSize*minMainSize);}
6352 if(typeof minimumMainSizeConstraint!=="number")
6353 minMainSize=Math.max(minMainSize,minPadding);var to=totalSize-minMainSize;if(from<=to)
6354 return Number.constrain(sidebarSize,from,to);if(!fromInPercents&&!toInPercents)
6355 return-1;if(toInPercents&&sidebarSize>=from&&from<totalSize)
6356 return from;if(fromInPercents&&sidebarSize<=to&&to<totalSize)
6357 return to;return-1;},wasShown:function()
6358 {this._updateLayout();},onResize:function()
6359 {if(this._muteOnResize)
6360 return;this._updateLayout();},_startResizerDragging:function(event)
6361 {if(!this._resizable)
6362 return false;this._saveSidebarSizeRecursively();this._dragOffset=(this._secondIsSidebar?this.totalSize()-this._sidebarSize:this._sidebarSize)-(this._isVertical?event.pageX:event.pageY);return true;},_resizerDragging:function(event)
6363 {var newOffset=(this._isVertical?event.pageX:event.pageY)+this._dragOffset;var newSize=(this._secondIsSidebar?this.totalSize()-newOffset:newOffset);this.setSidebarSize(newSize);event.preventDefault();},_endResizerDragging:function(event)
6364 {delete this._dragOffset;this._saveSidebarSizeRecursively();},_saveSidebarSizeRecursively:function()
6365 {function doSaveSidebarSizeRecursively()
6366 {if(this._saveSidebarSize)
6367 this._saveSidebarSize();this._callOnVisibleChildren(doSaveSidebarSizeRecursively);}
6368 this._saveSidebarSize();this._callOnVisibleChildren(doSaveSidebarSizeRecursively);},installResizer:function(resizerElement)
6369 {resizerElement.addEventListener("mousedown",this._onDragStartBound,false);resizerElement.style.setProperty("cursor",this._isVertical?"ew-resize":"ns-resize");this._resizerElements.push(resizerElement);},uninstallResizer:function(resizerElement)
6370 {resizerElement.removeEventListener("mousedown",this._onDragStartBound,false);resizerElement.style.removeProperty("cursor");this._resizerElements.remove(resizerElement);},_onDragStart:function(event)
6371 {WebInspector.elementDragStart(this._startResizerDragging.bind(this),this._resizerDragging.bind(this),this._endResizerDragging.bind(this),this._isVertical?"ew-resize":"ns-resize",event);},_sizeSetting:function()
6372 {if(!this._sidebarSizeSettingName)
6373 return null;var settingName=this._sidebarSizeSettingName+(this._isVertical?"":"H");if(!WebInspector.settings[settingName])
6374 WebInspector.settings[settingName]=WebInspector.settings.createSetting(settingName,undefined);return WebInspector.settings[settingName];},_lastSidebarSize:function()
6375 {var sizeSetting=this._sizeSetting();var size=sizeSetting?sizeSetting.get():0;if(!size)
6376 size=this._isVertical?this._savedSidebarWidth:this._savedSidebarHeight;if(this._useFraction)
6377 size*=this.totalSize();return size;},_saveSidebarSize:function()
6378 {var size=this._sidebarSize;if(size<0)
6379 return;if(this._useFraction)
6380 size/=this.totalSize();if(this._isVertical)
6381 this._savedSidebarWidth=size;else
6382 this._savedSidebarHeight=size;var sizeSetting=this._sizeSetting();if(sizeSetting)
6383 sizeSetting.set(size);},__proto__:WebInspector.View.prototype}
6384 WebInspector.StackView=function(isVertical)
6385 {WebInspector.View.call(this);this._isVertical=isVertical;}
6386 WebInspector.StackView.prototype={appendView:function(view,sidebarSizeSettingName,defaultSidebarWidth,defaultSidebarHeight)
6387 {var splitView=new WebInspector.SplitView(this._isVertical,sidebarSizeSettingName,defaultSidebarWidth,defaultSidebarHeight);splitView.setFirstView(view);splitView.showOnlyFirst();if(!this._currentSplitView){splitView.show(this.element);}else{this._currentSplitView.setSecondView(splitView);this._currentSplitView.showBoth();}
6388 this._currentSplitView=splitView;return splitView;},__proto__:WebInspector.View.prototype}
6389 WebInspector.SidebarView=function(sidebarPosition,sidebarWidthSettingName,defaultSidebarWidth,defaultSidebarHeight)
6390 {WebInspector.SplitView.call(this,true,sidebarWidthSettingName,defaultSidebarWidth,defaultSidebarHeight);this.setSidebarElementConstraints(Preferences.minSidebarWidth,Preferences.minSidebarHeight);this.setMainElementConstraints(0.5,0.5);this.setSecondIsSidebar(sidebarPosition===WebInspector.SidebarView.SidebarPosition.End);}
6391 WebInspector.SidebarView.EventTypes={Resized:"Resized"}
6392 WebInspector.SidebarView.SidebarPosition={Start:"Start",End:"End"}
6393 WebInspector.SidebarView.prototype={setSidebarWidth:function(width)
6394 {this.setSidebarSize(width);},sidebarWidth:function()
6395 {return this.sidebarSize();},onResize:function()
6396 {WebInspector.SplitView.prototype.onResize.call(this);this.dispatchEventToListeners(WebInspector.SidebarView.EventTypes.Resized,this.sidebarWidth());},hideMainElement:function()
6397 {if(this.isSidebarSecond())
6398 this.showOnlySecond();else
6399 this.showOnlyFirst();},showMainElement:function()
6400 {this.showBoth();},hideSidebarElement:function()
6401 {if(this.isSidebarSecond())
6402 this.showOnlyFirst();else
6403 this.showOnlySecond();},showSidebarElement:function()
6404 {this.showBoth();},elementsToRestoreScrollPositionsFor:function()
6405 {return[this.mainElement(),this.sidebarElement()];},__proto__:WebInspector.SplitView.prototype}
6406 WebInspector.ConsolePanel=function()
6407 {WebInspector.Panel.call(this,"console");this._view=WebInspector.consoleView;}
6408 WebInspector.ConsolePanel.prototype={defaultFocusedElement:function()
6409 {return this._view.defaultFocusedElement();},wasShown:function()
6410 {WebInspector.Panel.prototype.wasShown.call(this);this._view.show(this.element);},willHide:function()
6411 {WebInspector.Panel.prototype.willHide.call(this);if(WebInspector.ConsolePanel.WrapperView._instance)
6412 WebInspector.ConsolePanel.WrapperView._instance._showViewInWrapper();},__proto__:WebInspector.Panel.prototype}
6413 WebInspector.ConsolePanel.ViewFactory=function()
6414 {}
6415 WebInspector.ConsolePanel.ViewFactory.prototype={createView:function()
6416 {if(!WebInspector.ConsolePanel.WrapperView._instance)
6417 WebInspector.ConsolePanel.WrapperView._instance=new WebInspector.ConsolePanel.WrapperView();return WebInspector.ConsolePanel.WrapperView._instance;}}
6418 WebInspector.ConsolePanel.WrapperView=function()
6419 {WebInspector.View.call(this);this.element.className="fill console-view-wrapper";this._view=WebInspector.consoleView;this.wasShown();}
6420 WebInspector.ConsolePanel.WrapperView.prototype={wasShown:function()
6421 {if(!WebInspector.inspectorView.currentPanel()||WebInspector.inspectorView.currentPanel().name!=="console")
6422 this._showViewInWrapper();},defaultFocusedElement:function()
6423 {return this._view.defaultFocusedElement();},focus:function()
6424 {this._view.focus();},_showViewInWrapper:function()
6425 {this._view.show(this.element);},__proto__:WebInspector.View.prototype}
6426 function defineCommonExtensionSymbols(apiPrivate)
6427 {if(!apiPrivate.audits)
6428 apiPrivate.audits={};apiPrivate.audits.Severity={Info:"info",Warning:"warning",Severe:"severe"};if(!apiPrivate.console)
6429 apiPrivate.console={};apiPrivate.console.Severity={Debug:"debug",Log:"log",Warning:"warning",Error:"error"};if(!apiPrivate.panels)
6430 apiPrivate.panels={};apiPrivate.panels.SearchAction={CancelSearch:"cancelSearch",PerformSearch:"performSearch",NextSearchResult:"nextSearchResult",PreviousSearchResult:"previousSearchResult"};apiPrivate.Events={AuditStarted:"audit-started-",ButtonClicked:"button-clicked-",ConsoleMessageAdded:"console-message-added",PanelObjectSelected:"panel-objectSelected-",NetworkRequestFinished:"network-request-finished",OpenResource:"open-resource",PanelSearch:"panel-search-",ResourceAdded:"resource-added",ResourceContentCommitted:"resource-content-committed",TimelineEventRecorded:"timeline-event-recorded",ViewShown:"view-shown-",ViewHidden:"view-hidden-"};apiPrivate.Commands={AddAuditCategory:"addAuditCategory",AddAuditResult:"addAuditResult",AddConsoleMessage:"addConsoleMessage",AddRequestHeaders:"addRequestHeaders",ApplyStyleSheet:"applyStyleSheet",CreatePanel:"createPanel",CreateSidebarPane:"createSidebarPane",CreateStatusBarButton:"createStatusBarButton",EvaluateOnInspectedPage:"evaluateOnInspectedPage",ForwardKeyboardEvent:"_forwardKeyboardEvent",GetConsoleMessages:"getConsoleMessages",GetHAR:"getHAR",GetPageResources:"getPageResources",GetRequestContent:"getRequestContent",GetResourceContent:"getResourceContent",InspectedURLChanged:"inspectedURLChanged",OpenResource:"openResource",Reload:"Reload",Subscribe:"subscribe",SetOpenResourceHandler:"setOpenResourceHandler",SetResourceContent:"setResourceContent",SetSidebarContent:"setSidebarContent",SetSidebarHeight:"setSidebarHeight",SetSidebarPage:"setSidebarPage",ShowPanel:"showPanel",StopAuditCategoryRun:"stopAuditCategoryRun",Unsubscribe:"unsubscribe",UpdateAuditProgress:"updateAuditProgress",UpdateButton:"updateButton"};}
6431 function injectedExtensionAPI(injectedScriptId)
6432 {var apiPrivate={};defineCommonExtensionSymbols(apiPrivate);var commands=apiPrivate.Commands;var events=apiPrivate.Events;var userAction=false;function EventSinkImpl(type,customDispatch)
6433 {this._type=type;this._listeners=[];this._customDispatch=customDispatch;}
6434 EventSinkImpl.prototype={addListener:function(callback)
6435 {if(typeof callback!=="function")
6436 throw"addListener: callback is not a function";if(this._listeners.length===0)
6437 extensionServer.sendRequest({command:commands.Subscribe,type:this._type});this._listeners.push(callback);extensionServer.registerHandler("notify-"+this._type,this._dispatch.bind(this));},removeListener:function(callback)
6438 {var listeners=this._listeners;for(var i=0;i<listeners.length;++i){if(listeners[i]===callback){listeners.splice(i,1);break;}}
6439 if(this._listeners.length===0)
6440 extensionServer.sendRequest({command:commands.Unsubscribe,type:this._type});},_fire:function(vararg)
6441 {var listeners=this._listeners.slice();for(var i=0;i<listeners.length;++i)
6442 listeners[i].apply(null,arguments);},_dispatch:function(request)
6443 {if(this._customDispatch)
6444 this._customDispatch.call(this,request);else
6445 this._fire.apply(this,request.arguments);}}
6446 function InspectorExtensionAPI()
6447 {this.audits=new Audits();this.inspectedWindow=new InspectedWindow();this.panels=new Panels();this.network=new Network();defineDeprecatedProperty(this,"webInspector","resources","network");this.timeline=new Timeline();this.console=new ConsoleAPI();}
6448 function ConsoleAPI()
6449 {this.onMessageAdded=new EventSink(events.ConsoleMessageAdded);}
6450 ConsoleAPI.prototype={getMessages:function(callback)
6451 {extensionServer.sendRequest({command:commands.GetConsoleMessages},callback);},addMessage:function(severity,text,url,line)
6452 {extensionServer.sendRequest({command:commands.AddConsoleMessage,severity:severity,text:text,url:url,line:line});},get Severity()
6453 {return apiPrivate.console.Severity;}}
6454 function Network()
6455 {function dispatchRequestEvent(message)
6456 {var request=message.arguments[1];request.__proto__=new Request(message.arguments[0]);this._fire(request);}
6457 this.onRequestFinished=new EventSink(events.NetworkRequestFinished,dispatchRequestEvent);defineDeprecatedProperty(this,"network","onFinished","onRequestFinished");this.onNavigated=new EventSink(events.InspectedURLChanged);}
6458 Network.prototype={getHAR:function(callback)
6459 {function callbackWrapper(result)
6460 {var entries=(result&&result.entries)||[];for(var i=0;i<entries.length;++i){entries[i].__proto__=new Request(entries[i]._requestId);delete entries[i]._requestId;}
6461 callback(result);}
6462 return extensionServer.sendRequest({command:commands.GetHAR},callback&&callbackWrapper);},addRequestHeaders:function(headers)
6463 {return extensionServer.sendRequest({command:commands.AddRequestHeaders,headers:headers,extensionId:window.location.hostname});}}
6464 function RequestImpl(id)
6465 {this._id=id;}
6466 RequestImpl.prototype={getContent:function(callback)
6467 {function callbackWrapper(response)
6468 {callback(response.content,response.encoding);}
6469 extensionServer.sendRequest({command:commands.GetRequestContent,id:this._id},callback&&callbackWrapper);}}
6470 function Panels()
6471 {var panels={elements:new ElementsPanel(),sources:new SourcesPanel(),};function panelGetter(name)
6472 {return panels[name];}
6473 for(var panel in panels)
6474 this.__defineGetter__(panel,panelGetter.bind(null,panel));this.applyStyleSheet=function(styleSheet){extensionServer.sendRequest({command:commands.ApplyStyleSheet,styleSheet:styleSheet});};}
6475 Panels.prototype={create:function(title,icon,page,callback)
6476 {var id="extension-panel-"+extensionServer.nextObjectId();var request={command:commands.CreatePanel,id:id,title:title,icon:icon,page:page};extensionServer.sendRequest(request,callback&&callback.bind(this,new ExtensionPanel(id)));},setOpenResourceHandler:function(callback)
6477 {var hadHandler=extensionServer.hasHandler(events.OpenResource);function callbackWrapper(message)
6478 {userAction=true;try{callback.call(null,new Resource(message.resource),message.lineNumber);}finally{userAction=false;}}
6479 if(!callback)
6480 extensionServer.unregisterHandler(events.OpenResource);else
6481 extensionServer.registerHandler(events.OpenResource,callbackWrapper);if(hadHandler===!callback)
6482 extensionServer.sendRequest({command:commands.SetOpenResourceHandler,"handlerPresent":!!callback});},openResource:function(url,lineNumber,callback)
6483 {extensionServer.sendRequest({command:commands.OpenResource,"url":url,"lineNumber":lineNumber},callback);},get SearchAction()
6484 {return apiPrivate.panels.SearchAction;}}
6485 function ExtensionViewImpl(id)
6486 {this._id=id;function dispatchShowEvent(message)
6487 {var frameIndex=message.arguments[0];if(typeof frameIndex==="number")
6488 this._fire(window.parent.frames[frameIndex]);else
6489 this._fire();}
6490 this.onShown=new EventSink(events.ViewShown+id,dispatchShowEvent);this.onHidden=new EventSink(events.ViewHidden+id);}
6491 function PanelWithSidebarImpl(hostPanelName)
6492 {this._hostPanelName=hostPanelName;this.onSelectionChanged=new EventSink(events.PanelObjectSelected+hostPanelName);}
6493 PanelWithSidebarImpl.prototype={createSidebarPane:function(title,callback)
6494 {var id="extension-sidebar-"+extensionServer.nextObjectId();var request={command:commands.CreateSidebarPane,panel:this._hostPanelName,id:id,title:title};function callbackWrapper()
6495 {callback(new ExtensionSidebarPane(id));}
6496 extensionServer.sendRequest(request,callback&&callbackWrapper);},__proto__:ExtensionViewImpl.prototype}
6497 function declareInterfaceClass(implConstructor)
6498 {return function()
6499 {var impl={__proto__:implConstructor.prototype};implConstructor.apply(impl,arguments);populateInterfaceClass(this,impl);}}
6500 function defineDeprecatedProperty(object,className,oldName,newName)
6501 {var warningGiven=false;function getter()
6502 {if(!warningGiven){console.warn(className+"."+oldName+" is deprecated. Use "+className+"."+newName+" instead");warningGiven=true;}
6503 return object[newName];}
6504 object.__defineGetter__(oldName,getter);}
6505 function extractCallbackArgument(args)
6506 {var lastArgument=args[args.length-1];return typeof lastArgument==="function"?lastArgument:undefined;}
6507 var AuditCategory=declareInterfaceClass(AuditCategoryImpl);var AuditResult=declareInterfaceClass(AuditResultImpl);var Button=declareInterfaceClass(ButtonImpl);var EventSink=declareInterfaceClass(EventSinkImpl);var ExtensionPanel=declareInterfaceClass(ExtensionPanelImpl);var ExtensionSidebarPane=declareInterfaceClass(ExtensionSidebarPaneImpl);var PanelWithSidebar=declareInterfaceClass(PanelWithSidebarImpl);var Request=declareInterfaceClass(RequestImpl);var Resource=declareInterfaceClass(ResourceImpl);var Timeline=declareInterfaceClass(TimelineImpl);function ElementsPanel()
6508 {PanelWithSidebar.call(this,"elements");}
6509 ElementsPanel.prototype={__proto__:PanelWithSidebar.prototype}
6510 function SourcesPanel()
6511 {PanelWithSidebar.call(this,"sources");}
6512 SourcesPanel.prototype={__proto__:PanelWithSidebar.prototype}
6513 function ExtensionPanelImpl(id)
6514 {ExtensionViewImpl.call(this,id);this.onSearch=new EventSink(events.PanelSearch+id);}
6515 ExtensionPanelImpl.prototype={createStatusBarButton:function(iconPath,tooltipText,disabled)
6516 {var id="button-"+extensionServer.nextObjectId();var request={command:commands.CreateStatusBarButton,panel:this._id,id:id,icon:iconPath,tooltip:tooltipText,disabled:!!disabled};extensionServer.sendRequest(request);return new Button(id);},show:function()
6517 {if(!userAction)
6518 return;var request={command:commands.ShowPanel,id:this._id};extensionServer.sendRequest(request);},__proto__:ExtensionViewImpl.prototype}
6519 function ExtensionSidebarPaneImpl(id)
6520 {ExtensionViewImpl.call(this,id);}
6521 ExtensionSidebarPaneImpl.prototype={setHeight:function(height)
6522 {extensionServer.sendRequest({command:commands.SetSidebarHeight,id:this._id,height:height});},setExpression:function(expression,rootTitle,evaluateOptions)
6523 {var request={command:commands.SetSidebarContent,id:this._id,expression:expression,rootTitle:rootTitle,evaluateOnPage:true,};if(typeof evaluateOptions==="object")
6524 request.evaluateOptions=evaluateOptions;extensionServer.sendRequest(request,extractCallbackArgument(arguments));},setObject:function(jsonObject,rootTitle,callback)
6525 {extensionServer.sendRequest({command:commands.SetSidebarContent,id:this._id,expression:jsonObject,rootTitle:rootTitle},callback);},setPage:function(page)
6526 {extensionServer.sendRequest({command:commands.SetSidebarPage,id:this._id,page:page});},__proto__:ExtensionViewImpl.prototype}
6527 function ButtonImpl(id)
6528 {this._id=id;this.onClicked=new EventSink(events.ButtonClicked+id);}
6529 ButtonImpl.prototype={update:function(iconPath,tooltipText,disabled)
6530 {var request={command:commands.UpdateButton,id:this._id,icon:iconPath,tooltip:tooltipText,disabled:!!disabled};extensionServer.sendRequest(request);}};function Audits()
6531 {}
6532 Audits.prototype={addCategory:function(displayName,resultCount)
6533 {var id="extension-audit-category-"+extensionServer.nextObjectId();if(typeof resultCount!=="undefined")
6534 console.warn("Passing resultCount to audits.addCategory() is deprecated. Use AuditResult.updateProgress() instead.");extensionServer.sendRequest({command:commands.AddAuditCategory,id:id,displayName:displayName,resultCount:resultCount});return new AuditCategory(id);}}
6535 function AuditCategoryImpl(id)
6536 {function dispatchAuditEvent(request)
6537 {var auditResult=new AuditResult(request.arguments[0]);try{this._fire(auditResult);}catch(e){console.error("Uncaught exception in extension audit event handler: "+e);auditResult.done();}}
6538 this._id=id;this.onAuditStarted=new EventSink(events.AuditStarted+id,dispatchAuditEvent);}
6539 function AuditResultImpl(id)
6540 {this._id=id;this.createURL=this._nodeFactory.bind(null,"url");this.createSnippet=this._nodeFactory.bind(null,"snippet");this.createText=this._nodeFactory.bind(null,"text");this.createObject=this._nodeFactory.bind(null,"object");this.createNode=this._nodeFactory.bind(null,"node");}
6541 AuditResultImpl.prototype={addResult:function(displayName,description,severity,details)
6542 {if(details&&!(details instanceof AuditResultNode))
6543 details=new AuditResultNode(details instanceof Array?details:[details]);var request={command:commands.AddAuditResult,resultId:this._id,displayName:displayName,description:description,severity:severity,details:details};extensionServer.sendRequest(request);},createResult:function()
6544 {return new AuditResultNode(Array.prototype.slice.call(arguments));},updateProgress:function(worked,totalWork)
6545 {extensionServer.sendRequest({command:commands.UpdateAuditProgress,resultId:this._id,progress:worked/totalWork});},done:function()
6546 {extensionServer.sendRequest({command:commands.StopAuditCategoryRun,resultId:this._id});},get Severity()
6547 {return apiPrivate.audits.Severity;},createResourceLink:function(url,lineNumber)
6548 {return{type:"resourceLink",arguments:[url,lineNumber&&lineNumber-1]};},_nodeFactory:function(type)
6549 {return{type:type,arguments:Array.prototype.slice.call(arguments,1)};}}
6550 function AuditResultNode(contents)
6551 {this.contents=contents;this.children=[];this.expanded=false;}
6552 AuditResultNode.prototype={addChild:function()
6553 {var node=new AuditResultNode(Array.prototype.slice.call(arguments));this.children.push(node);return node;}};function InspectedWindow()
6554 {function dispatchResourceEvent(message)
6555 {this._fire(new Resource(message.arguments[0]));}
6556 function dispatchResourceContentEvent(message)
6557 {this._fire(new Resource(message.arguments[0]),message.arguments[1]);}
6558 this.onResourceAdded=new EventSink(events.ResourceAdded,dispatchResourceEvent);this.onResourceContentCommitted=new EventSink(events.ResourceContentCommitted,dispatchResourceContentEvent);}
6559 InspectedWindow.prototype={reload:function(optionsOrUserAgent)
6560 {var options=null;if(typeof optionsOrUserAgent==="object")
6561 options=optionsOrUserAgent;else if(typeof optionsOrUserAgent==="string"){options={userAgent:optionsOrUserAgent};console.warn("Passing userAgent as string parameter to inspectedWindow.reload() is deprecated. "+"Use inspectedWindow.reload({ userAgent: value}) instead.");}
6562 return extensionServer.sendRequest({command:commands.Reload,options:options});},eval:function(expression,evaluateOptions)
6563 {var callback=extractCallbackArgument(arguments);function callbackWrapper(result)
6564 {if(result.isError||result.isException)
6565 callback(undefined,result);else
6566 callback(result.value);}
6567 var request={command:commands.EvaluateOnInspectedPage,expression:expression};if(typeof evaluateOptions==="object")
6568 request.evaluateOptions=evaluateOptions;return extensionServer.sendRequest(request,callback&&callbackWrapper);},getResources:function(callback)
6569 {function wrapResource(resourceData)
6570 {return new Resource(resourceData);}
6571 function callbackWrapper(resources)
6572 {callback(resources.map(wrapResource));}
6573 return extensionServer.sendRequest({command:commands.GetPageResources},callback&&callbackWrapper);}}
6574 function ResourceImpl(resourceData)
6575 {this._url=resourceData.url
6576 this._type=resourceData.type;}
6577 ResourceImpl.prototype={get url()
6578 {return this._url;},get type()
6579 {return this._type;},getContent:function(callback)
6580 {function callbackWrapper(response)
6581 {callback(response.content,response.encoding);}
6582 return extensionServer.sendRequest({command:commands.GetResourceContent,url:this._url},callback&&callbackWrapper);},setContent:function(content,commit,callback)
6583 {return extensionServer.sendRequest({command:commands.SetResourceContent,url:this._url,content:content,commit:commit},callback);}}
6584 function TimelineImpl()
6585 {this.onEventRecorded=new EventSink(events.TimelineEventRecorded);}
6586 function forwardKeyboardEvent(event)
6587 {const Esc="U+001B";if(!event.ctrlKey&&!event.altKey&&!event.metaKey&&!/^F\d+$/.test(event.keyIdentifier)&&event.keyIdentifier!==Esc)
6588 return;var request={command:commands.ForwardKeyboardEvent,eventType:event.type,ctrlKey:event.ctrlKey,altKey:event.altKey,metaKey:event.metaKey,keyIdentifier:event.keyIdentifier,location:event.location};extensionServer.sendRequest(request);}
6589 document.addEventListener("keydown",forwardKeyboardEvent,false);document.addEventListener("keypress",forwardKeyboardEvent,false);function ExtensionServerClient()
6590 {this._callbacks={};this._handlers={};this._lastRequestId=0;this._lastObjectId=0;this.registerHandler("callback",this._onCallback.bind(this));var channel=new MessageChannel();this._port=channel.port1;this._port.addEventListener("message",this._onMessage.bind(this),false);this._port.start();window.parent.postMessage("registerExtension",[channel.port2],"*");}
6591 ExtensionServerClient.prototype={sendRequest:function(message,callback)
6592 {if(typeof callback==="function")
6593 message.requestId=this._registerCallback(callback);return this._port.postMessage(message);},hasHandler:function(command)
6594 {return!!this._handlers[command];},registerHandler:function(command,handler)
6595 {this._handlers[command]=handler;},unregisterHandler:function(command)
6596 {delete this._handlers[command];},nextObjectId:function()
6597 {return injectedScriptId+"_"+ ++this._lastObjectId;},_registerCallback:function(callback)
6598 {var id=++this._lastRequestId;this._callbacks[id]=callback;return id;},_onCallback:function(request)
6599 {if(request.requestId in this._callbacks){var callback=this._callbacks[request.requestId];delete this._callbacks[request.requestId];callback(request.result);}},_onMessage:function(event)
6600 {var request=event.data;var handler=this._handlers[request.command];if(handler)
6601 handler.call(this,request);}}
6602 function populateInterfaceClass(interface,implementation)
6603 {for(var member in implementation){if(member.charAt(0)==="_")
6604 continue;var descriptor=null;for(var owner=implementation;owner&&!descriptor;owner=owner.__proto__)
6605 descriptor=Object.getOwnPropertyDescriptor(owner,member);if(!descriptor)
6606 continue;if(typeof descriptor.value==="function")
6607 interface[member]=descriptor.value.bind(implementation);else if(typeof descriptor.get==="function")
6608 interface.__defineGetter__(member,descriptor.get.bind(implementation));else
6609 Object.defineProperty(interface,member,descriptor);}}
6610 if(!extensionServer)
6611 extensionServer=new ExtensionServerClient();return new InspectorExtensionAPI();}
6612 function buildExtensionAPIInjectedScript(extensionInfo)
6613 {return"(function(injectedScriptId){ "+"var extensionServer;"+
6614 defineCommonExtensionSymbols.toString()+";"+
6615 injectedExtensionAPI.toString()+";"+
6616 buildPlatformExtensionAPI(extensionInfo)+";"+"platformExtensionAPI(injectedExtensionAPI(injectedScriptId));"+"return {};"+"})";}
6617 WebInspector.ExtensionAuditCategory=function(extensionOrigin,id,displayName,ruleCount)
6618 {this._extensionOrigin=extensionOrigin;this._id=id;this._displayName=displayName;this._ruleCount=ruleCount;}
6619 WebInspector.ExtensionAuditCategory.prototype={get id()
6620 {return this._id;},get displayName()
6621 {return this._displayName;},run:function(requests,ruleResultCallback,categoryDoneCallback,progress)
6622 {var results=new WebInspector.ExtensionAuditCategoryResults(this,ruleResultCallback,categoryDoneCallback,progress);WebInspector.extensionServer.startAuditRun(this,results);}}
6623 WebInspector.ExtensionAuditCategoryResults=function(category,ruleResultCallback,categoryDoneCallback,progress)
6624 {this._category=category;this._ruleResultCallback=ruleResultCallback;this._categoryDoneCallback=categoryDoneCallback;this._progress=progress;this._progress.setTotalWork(1);this._expectedResults=category._ruleCount;this._actualResults=0;this.id=category.id+"-"+ ++WebInspector.ExtensionAuditCategoryResults._lastId;}
6625 WebInspector.ExtensionAuditCategoryResults.prototype={done:function()
6626 {WebInspector.extensionServer.stopAuditRun(this);this._progress.done();this._categoryDoneCallback();},addResult:function(displayName,description,severity,details)
6627 {var result=new WebInspector.AuditRuleResult(displayName);result.addChild(description);result.severity=severity;if(details)
6628 this._addNode(result,details);this._addResult(result);},_addNode:function(parent,node)
6629 {var contents=WebInspector.auditFormatters.partiallyApply(WebInspector.ExtensionAuditFormatters,this,node.contents);var addedNode=parent.addChild(contents,node.expanded);if(node.children){for(var i=0;i<node.children.length;++i)
6630 this._addNode(addedNode,node.children[i]);}},_addResult:function(result)
6631 {this._ruleResultCallback(result);++this._actualResults;if(typeof this._expectedResults==="number"){this._progress.setWorked(this._actualResults/this._expectedResults);if(this._actualResults===this._expectedResults)
6632 this.done();}},updateProgress:function(progress)
6633 {this._progress.setWorked(progress);},evaluate:function(expression,evaluateOptions,callback)
6634 {function onEvaluate(error,result,wasThrown)
6635 {if(wasThrown)
6636 return;var object=WebInspector.RemoteObject.fromPayload(result);callback(object);}
6637 WebInspector.extensionServer.evaluate(expression,false,false,evaluateOptions,this._category._extensionOrigin,onEvaluate);}}
6638 WebInspector.ExtensionAuditFormatters={object:function(expression,title,evaluateOptions)
6639 {var parentElement=document.createElement("div");function onEvaluate(remoteObject)
6640 {var section=new WebInspector.ObjectPropertiesSection(remoteObject,title);section.expanded=true;section.editable=false;parentElement.appendChild(section.element);}
6641 this.evaluate(expression,evaluateOptions,onEvaluate);return parentElement;},node:function(expression,evaluateOptions)
6642 {var parentElement=document.createElement("div");function onNodeAvailable(nodeId)
6643 {if(!nodeId)
6644 return;var treeOutline=new WebInspector.ElementsTreeOutline(false,false);treeOutline.rootDOMNode=WebInspector.domAgent.nodeForId(nodeId);treeOutline.element.classList.add("outline-disclosure");treeOutline.setVisible(true);parentElement.appendChild(treeOutline.element);}
6645 function onEvaluate(remoteObject)
6646 {remoteObject.pushNodeToFrontend(onNodeAvailable);}
6647 this.evaluate(expression,evaluateOptions,onEvaluate);return parentElement;}}
6648 WebInspector.ExtensionAuditCategoryResults._lastId=0;WebInspector.ExtensionServer=function()
6649 {this._clientObjects={};this._handlers={};this._subscribers={};this._subscriptionStartHandlers={};this._subscriptionStopHandlers={};this._extraHeaders={};this._requests={};this._lastRequestId=0;this._registeredExtensions={};this._status=new WebInspector.ExtensionStatus();var commands=WebInspector.extensionAPI.Commands;this._registerHandler(commands.AddAuditCategory,this._onAddAuditCategory.bind(this));this._registerHandler(commands.AddAuditResult,this._onAddAuditResult.bind(this));this._registerHandler(commands.AddConsoleMessage,this._onAddConsoleMessage.bind(this));this._registerHandler(commands.AddRequestHeaders,this._onAddRequestHeaders.bind(this));this._registerHandler(commands.ApplyStyleSheet,this._onApplyStyleSheet.bind(this));this._registerHandler(commands.CreatePanel,this._onCreatePanel.bind(this));this._registerHandler(commands.CreateSidebarPane,this._onCreateSidebarPane.bind(this));this._registerHandler(commands.CreateStatusBarButton,this._onCreateStatusBarButton.bind(this));this._registerHandler(commands.EvaluateOnInspectedPage,this._onEvaluateOnInspectedPage.bind(this));this._registerHandler(commands.ForwardKeyboardEvent,this._onForwardKeyboardEvent.bind(this));this._registerHandler(commands.GetHAR,this._onGetHAR.bind(this));this._registerHandler(commands.GetConsoleMessages,this._onGetConsoleMessages.bind(this));this._registerHandler(commands.GetPageResources,this._onGetPageResources.bind(this));this._registerHandler(commands.GetRequestContent,this._onGetRequestContent.bind(this));this._registerHandler(commands.GetResourceContent,this._onGetResourceContent.bind(this));this._registerHandler(commands.Reload,this._onReload.bind(this));this._registerHandler(commands.SetOpenResourceHandler,this._onSetOpenResourceHandler.bind(this));this._registerHandler(commands.SetResourceContent,this._onSetResourceContent.bind(this));this._registerHandler(commands.SetSidebarHeight,this._onSetSidebarHeight.bind(this));this._registerHandler(commands.SetSidebarContent,this._onSetSidebarContent.bind(this));this._registerHandler(commands.SetSidebarPage,this._onSetSidebarPage.bind(this));this._registerHandler(commands.ShowPanel,this._onShowPanel.bind(this));this._registerHandler(commands.StopAuditCategoryRun,this._onStopAuditCategoryRun.bind(this));this._registerHandler(commands.Subscribe,this._onSubscribe.bind(this));this._registerHandler(commands.OpenResource,this._onOpenResource.bind(this));this._registerHandler(commands.Unsubscribe,this._onUnsubscribe.bind(this));this._registerHandler(commands.UpdateButton,this._onUpdateButton.bind(this));this._registerHandler(commands.UpdateAuditProgress,this._onUpdateAuditProgress.bind(this));window.addEventListener("message",this._onWindowMessage.bind(this),false);}
6650 WebInspector.ExtensionServer.prototype={hasExtensions:function()
6651 {return!!Object.keys(this._registeredExtensions).length;},notifySearchAction:function(panelId,action,searchString)
6652 {this._postNotification(WebInspector.extensionAPI.Events.PanelSearch+panelId,action,searchString);},notifyViewShown:function(identifier,frameIndex)
6653 {this._postNotification(WebInspector.extensionAPI.Events.ViewShown+identifier,frameIndex);},notifyViewHidden:function(identifier)
6654 {this._postNotification(WebInspector.extensionAPI.Events.ViewHidden+identifier);},notifyButtonClicked:function(identifier)
6655 {this._postNotification(WebInspector.extensionAPI.Events.ButtonClicked+identifier);},_inspectedURLChanged:function(event)
6656 {this._requests={};var url=event.data;this._postNotification(WebInspector.extensionAPI.Events.InspectedURLChanged,url);},startAuditRun:function(category,auditRun)
6657 {this._clientObjects[auditRun.id]=auditRun;this._postNotification("audit-started-"+category.id,auditRun.id);},stopAuditRun:function(auditRun)
6658 {delete this._clientObjects[auditRun.id];},hasSubscribers:function(type)
6659 {return!!this._subscribers[type];},_postNotification:function(type,vararg)
6660 {var subscribers=this._subscribers[type];if(!subscribers)
6661 return;var message={command:"notify-"+type,arguments:Array.prototype.slice.call(arguments,1)};for(var i=0;i<subscribers.length;++i)
6662 subscribers[i].postMessage(message);},_onSubscribe:function(message,port)
6663 {var subscribers=this._subscribers[message.type];if(subscribers)
6664 subscribers.push(port);else{this._subscribers[message.type]=[port];if(this._subscriptionStartHandlers[message.type])
6665 this._subscriptionStartHandlers[message.type]();}},_onUnsubscribe:function(message,port)
6666 {var subscribers=this._subscribers[message.type];if(!subscribers)
6667 return;subscribers.remove(port);if(!subscribers.length){delete this._subscribers[message.type];if(this._subscriptionStopHandlers[message.type])
6668 this._subscriptionStopHandlers[message.type]();}},_onAddRequestHeaders:function(message)
6669 {var id=message.extensionId;if(typeof id!=="string")
6670 return this._status.E_BADARGTYPE("extensionId",typeof id,"string");var extensionHeaders=this._extraHeaders[id];if(!extensionHeaders){extensionHeaders={};this._extraHeaders[id]=extensionHeaders;}
6671 for(var name in message.headers)
6672 extensionHeaders[name]=message.headers[name];var allHeaders=({});for(var extension in this._extraHeaders){var headers=this._extraHeaders[extension];for(name in headers){if(typeof headers[name]==="string")
6673 allHeaders[name]=headers[name];}}
6674 NetworkAgent.setExtraHTTPHeaders(allHeaders);},_onApplyStyleSheet:function(message)
6675 {if(!WebInspector.experimentsSettings.applyCustomStylesheet.isEnabled())
6676 return;var styleSheet=document.createElement("style");styleSheet.textContent=message.styleSheet;document.head.appendChild(styleSheet);},_onCreatePanel:function(message,port)
6677 {var id=message.id;if(id in this._clientObjects||id in WebInspector.panels)
6678 return this._status.E_EXISTS(id);var page=this._expandResourcePath(port._extensionOrigin,message.page);var panelDescriptor=new WebInspector.ExtensionServerPanelDescriptor(id,message.title,new WebInspector.ExtensionPanel(id,page));this._clientObjects[id]=panelDescriptor.panel();WebInspector.inspectorView.addPanel(panelDescriptor);return this._status.OK();},_onShowPanel:function(message)
6679 {WebInspector.showPanel(message.id);},_onCreateStatusBarButton:function(message,port)
6680 {var panel=this._clientObjects[message.panel];if(!panel||!(panel instanceof WebInspector.ExtensionPanel))
6681 return this._status.E_NOTFOUND(message.panel);var button=new WebInspector.ExtensionButton(message.id,this._expandResourcePath(port._extensionOrigin,message.icon),message.tooltip,message.disabled);this._clientObjects[message.id]=button;panel.addStatusBarItem(button.element);return this._status.OK();},_onUpdateButton:function(message,port)
6682 {var button=this._clientObjects[message.id];if(!button||!(button instanceof WebInspector.ExtensionButton))
6683 return this._status.E_NOTFOUND(message.id);button.update(this._expandResourcePath(port._extensionOrigin,message.icon),message.tooltip,message.disabled);return this._status.OK();},_onCreateSidebarPane:function(message)
6684 {var panel=WebInspector.panel(message.panel);if(!panel)
6685 return this._status.E_NOTFOUND(message.panel);if(!panel.addExtensionSidebarPane)
6686 return this._status.E_NOTSUPPORTED();var id=message.id;var sidebar=new WebInspector.ExtensionSidebarPane(message.title,id);this._clientObjects[id]=sidebar;panel.addExtensionSidebarPane(id,sidebar);return this._status.OK();},_onSetSidebarHeight:function(message)
6687 {var sidebar=this._clientObjects[message.id];if(!sidebar)
6688 return this._status.E_NOTFOUND(message.id);sidebar.setHeight(message.height);return this._status.OK();},_onSetSidebarContent:function(message,port)
6689 {var sidebar=this._clientObjects[message.id];if(!sidebar)
6690 return this._status.E_NOTFOUND(message.id);function callback(error)
6691 {var result=error?this._status.E_FAILED(error):this._status.OK();this._dispatchCallback(message.requestId,port,result);}
6692 if(message.evaluateOnPage)
6693 return sidebar.setExpression(message.expression,message.rootTitle,message.evaluateOptions,port._extensionOrigin,callback.bind(this));sidebar.setObject(message.expression,message.rootTitle,callback.bind(this));},_onSetSidebarPage:function(message,port)
6694 {var sidebar=this._clientObjects[message.id];if(!sidebar)
6695 return this._status.E_NOTFOUND(message.id);sidebar.setPage(this._expandResourcePath(port._extensionOrigin,message.page));},_onOpenResource:function(message)
6696 {var a=document.createElement("a");a.href=message.url;a.lineNumber=message.lineNumber;return WebInspector.showAnchorLocation(a)?this._status.OK():this._status.E_NOTFOUND(message.url);},_onSetOpenResourceHandler:function(message,port)
6697 {var name=this._registeredExtensions[port._extensionOrigin].name||("Extension "+port._extensionOrigin);if(message.handlerPresent)
6698 WebInspector.openAnchorLocationRegistry.registerHandler(name,this._handleOpenURL.bind(this,port));else
6699 WebInspector.openAnchorLocationRegistry.unregisterHandler(name);},_handleOpenURL:function(port,details)
6700 {var url=(details.url);var contentProvider=WebInspector.workspace.uiSourceCodeForOriginURL(url)||WebInspector.resourceForURL(url);if(!contentProvider)
6701 return false;var lineNumber=details.lineNumber;if(typeof lineNumber==="number")
6702 lineNumber+=1;port.postMessage({command:"open-resource",resource:this._makeResource(contentProvider),lineNumber:lineNumber});return true;},_onReload:function(message)
6703 {var options=(message.options||{});NetworkAgent.setUserAgentOverride(typeof options.userAgent==="string"?options.userAgent:"");var injectedScript;if(options.injectedScript)
6704 injectedScript="(function(){"+options.injectedScript+"})()";var preprocessingScript=options.preprocessingScript;WebInspector.resourceTreeModel.reloadPage(!!options.ignoreCache,injectedScript,preprocessingScript);return this._status.OK();},_onEvaluateOnInspectedPage:function(message,port)
6705 {function callback(error,resultPayload,wasThrown)
6706 {var result;if(error||!resultPayload)
6707 result=this._status.E_PROTOCOLERROR(error.toString());else if(wasThrown)
6708 result={isException:true,value:resultPayload.description};else
6709 result={value:resultPayload.value};this._dispatchCallback(message.requestId,port,result);}
6710 return this.evaluate(message.expression,true,true,message.evaluateOptions,port._extensionOrigin,callback.bind(this));},_onGetConsoleMessages:function()
6711 {return WebInspector.console.messages.map(this._makeConsoleMessage);},_onAddConsoleMessage:function(message)
6712 {function convertSeverity(level)
6713 {switch(level){case WebInspector.extensionAPI.console.Severity.Log:return WebInspector.ConsoleMessage.MessageLevel.Log;case WebInspector.extensionAPI.console.Severity.Warning:return WebInspector.ConsoleMessage.MessageLevel.Warning;case WebInspector.extensionAPI.console.Severity.Error:return WebInspector.ConsoleMessage.MessageLevel.Error;case WebInspector.extensionAPI.console.Severity.Debug:return WebInspector.ConsoleMessage.MessageLevel.Debug;}}
6714 var level=convertSeverity(message.severity);if(!level)
6715 return this._status.E_BADARG("message.severity",message.severity);var consoleMessage=WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.JS,level,message.text,WebInspector.ConsoleMessage.MessageType.Log,message.url,message.line);WebInspector.console.addMessage(consoleMessage);},_makeConsoleMessage:function(message)
6716 {function convertLevel(level)
6717 {if(!level)
6718 return;switch(level){case WebInspector.ConsoleMessage.MessageLevel.Log:return WebInspector.extensionAPI.console.Severity.Log;case WebInspector.ConsoleMessage.MessageLevel.Warning:return WebInspector.extensionAPI.console.Severity.Warning;case WebInspector.ConsoleMessage.MessageLevel.Error:return WebInspector.extensionAPI.console.Severity.Error;case WebInspector.ConsoleMessage.MessageLevel.Debug:return WebInspector.extensionAPI.console.Severity.Debug;default:return WebInspector.extensionAPI.console.Severity.Log;}}
6719 var result={severity:convertLevel(message.level),text:message.text,};if(message.url)
6720 result.url=message.url;if(message.line)
6721 result.line=message.line;return result;},_onGetHAR:function()
6722 {var requests=WebInspector.networkLog.requests;var harLog=(new WebInspector.HARLog(requests)).build();for(var i=0;i<harLog.entries.length;++i)
6723 harLog.entries[i]._requestId=this._requestId(requests[i]);return harLog;},_makeResource:function(contentProvider)
6724 {return{url:contentProvider.contentURL(),type:contentProvider.contentType().name()};},_onGetPageResources:function()
6725 {var resources={};function pushResourceData(contentProvider)
6726 {if(!resources[contentProvider.contentURL()])
6727 resources[contentProvider.contentURL()]=this._makeResource(contentProvider);}
6728 var uiSourceCodes=WebInspector.workspace.uiSourceCodesForProjectType(WebInspector.projectTypes.Network);uiSourceCodes.forEach(pushResourceData.bind(this));WebInspector.resourceTreeModel.forAllResources(pushResourceData.bind(this));return Object.values(resources);},_getResourceContent:function(contentProvider,message,port)
6729 {function onContentAvailable(content)
6730 {var response={encoding:(content===null)||contentProvider.contentType().isTextType()?"":"base64",content:content};this._dispatchCallback(message.requestId,port,response);}
6731 contentProvider.requestContent(onContentAvailable.bind(this));},_onGetRequestContent:function(message,port)
6732 {var request=this._requestById(message.id);if(!request)
6733 return this._status.E_NOTFOUND(message.id);this._getResourceContent(request,message,port);},_onGetResourceContent:function(message,port)
6734 {var url=(message.url);var contentProvider=WebInspector.workspace.uiSourceCodeForOriginURL(url)||WebInspector.resourceForURL(url);if(!contentProvider)
6735 return this._status.E_NOTFOUND(url);this._getResourceContent(contentProvider,message,port);},_onSetResourceContent:function(message,port)
6736 {function callbackWrapper(error)
6737 {var response=error?this._status.E_FAILED(error):this._status.OK();this._dispatchCallback(message.requestId,port,response);}
6738 var url=(message.url);var uiSourceCode=WebInspector.workspace.uiSourceCodeForOriginURL(url);if(!uiSourceCode){var resource=WebInspector.resourceTreeModel.resourceForURL(url);if(!resource)
6739 return this._status.E_NOTFOUND(url);return this._status.E_NOTSUPPORTED("Resource is not editable")}
6740 uiSourceCode.setWorkingCopy(message.content);if(message.commit)
6741 uiSourceCode.commitWorkingCopy(callbackWrapper.bind(this));else
6742 callbackWrapper.call(this,null);},_requestId:function(request)
6743 {if(!request._extensionRequestId){request._extensionRequestId=++this._lastRequestId;this._requests[request._extensionRequestId]=request;}
6744 return request._extensionRequestId;},_requestById:function(id)
6745 {return this._requests[id];},_onAddAuditCategory:function(message,port)
6746 {var category=new WebInspector.ExtensionAuditCategory(port._extensionOrigin,message.id,message.displayName,message.resultCount);if(WebInspector.panel("audits").getCategory(category.id))
6747 return this._status.E_EXISTS(category.id);this._clientObjects[message.id]=category;WebInspector.panel("audits").addCategory(category);},_onAddAuditResult:function(message)
6748 {var auditResult=this._clientObjects[message.resultId];if(!auditResult)
6749 return this._status.E_NOTFOUND(message.resultId);try{auditResult.addResult(message.displayName,message.description,message.severity,message.details);}catch(e){return e;}
6750 return this._status.OK();},_onUpdateAuditProgress:function(message)
6751 {var auditResult=this._clientObjects[message.resultId];if(!auditResult)
6752 return this._status.E_NOTFOUND(message.resultId);auditResult.updateProgress(Math.min(Math.max(0,message.progress),1));},_onStopAuditCategoryRun:function(message)
6753 {var auditRun=this._clientObjects[message.resultId];if(!auditRun)
6754 return this._status.E_NOTFOUND(message.resultId);auditRun.done();},_onForwardKeyboardEvent:function(message)
6755 {const Esc="U+001B";if(!message.ctrlKey&&!message.altKey&&!message.metaKey&&!/^F\d+$/.test(message.keyIdentifier)&&message.keyIdentifier!==Esc)
6756 return;var event=new window.KeyboardEvent(message.eventType,{keyIdentifier:message.keyIdentifier,location:message.location,ctrlKey:message.ctrlKey,altKey:message.altKey,shiftKey:message.shiftKey,metaKey:message.metaKey});document.dispatchEvent(event);},_dispatchCallback:function(requestId,port,result)
6757 {if(requestId)
6758 port.postMessage({command:"callback",requestId:requestId,result:result});},initExtensions:function()
6759 {this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.ConsoleMessageAdded,WebInspector.console,WebInspector.ConsoleModel.Events.MessageAdded,this._notifyConsoleMessageAdded);this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.NetworkRequestFinished,WebInspector.networkManager,WebInspector.NetworkManager.EventTypes.RequestFinished,this._notifyRequestFinished);this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.ResourceAdded,WebInspector.workspace,WebInspector.Workspace.Events.UISourceCodeAdded,this._notifyResourceAdded);this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.PanelObjectSelected+"elements",WebInspector.notifications,WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,this._notifyElementsSelectionChanged);this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.PanelObjectSelected+"sources",WebInspector.notifications,WebInspector.SourceFrame.Events.SelectionChanged,this._notifySourceFrameSelectionChanged);this._registerResourceContentCommittedHandler(this._notifyUISourceCodeContentCommitted);function onTimelineSubscriptionStarted()
6760 {WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,this._notifyTimelineEventRecorded,this);WebInspector.timelineManager.start();}
6761 function onTimelineSubscriptionStopped()
6762 {WebInspector.timelineManager.stop();WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,this._notifyTimelineEventRecorded,this);}
6763 this._registerSubscriptionHandler(WebInspector.extensionAPI.Events.TimelineEventRecorded,onTimelineSubscriptionStarted.bind(this),onTimelineSubscriptionStopped.bind(this));WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._inspectedURLChanged,this);this._initDone=true;if(this._pendingExtensions){this._pendingExtensions.forEach(this._innerAddExtension,this);delete this._pendingExtensions;}
6764 InspectorExtensionRegistry.getExtensionsAsync();},_makeSourceSelection:function(textRange)
6765 {var sourcesPanel=WebInspector.inspectorView.panel("sources");var selection={startLine:textRange.startLine,startColumn:textRange.startColumn,endLine:textRange.endLine,endColumn:textRange.endColumn,url:sourcesPanel.tabbedEditorContainer.currentFile().uri()};return selection;},_notifySourceFrameSelectionChanged:function(event)
6766 {this._postNotification(WebInspector.extensionAPI.Events.PanelObjectSelected+"sources",this._makeSourceSelection(event.data));},_notifyConsoleMessageAdded:function(event)
6767 {this._postNotification(WebInspector.extensionAPI.Events.ConsoleMessageAdded,this._makeConsoleMessage(event.data));},_notifyResourceAdded:function(event)
6768 {var uiSourceCode=(event.data);this._postNotification(WebInspector.extensionAPI.Events.ResourceAdded,this._makeResource(uiSourceCode));},_notifyUISourceCodeContentCommitted:function(event)
6769 {var uiSourceCode=(event.data.uiSourceCode);var content=(event.data.content);this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted,this._makeResource(uiSourceCode),content);},_notifyRequestFinished:function(event)
6770 {var request=(event.data);this._postNotification(WebInspector.extensionAPI.Events.NetworkRequestFinished,this._requestId(request),(new WebInspector.HAREntry(request)).build());},_notifyElementsSelectionChanged:function()
6771 {this._postNotification(WebInspector.extensionAPI.Events.PanelObjectSelected+"elements");},_notifyTimelineEventRecorded:function(event)
6772 {this._postNotification(WebInspector.extensionAPI.Events.TimelineEventRecorded,event.data);},_addExtensions:function(extensions)
6773 {extensions.forEach(this._addExtension,this);},_addExtension:function(extensionInfo)
6774 {if(this._initDone){this._innerAddExtension(extensionInfo);return;}
6775 if(this._pendingExtensions)
6776 this._pendingExtensions.push(extensionInfo);else
6777 this._pendingExtensions=[extensionInfo];},_innerAddExtension:function(extensionInfo)
6778 {const urlOriginRegExp=new RegExp("([^:]+:\/\/[^/]*)\/");var startPage=extensionInfo.startPage;var name=extensionInfo.name;try{var originMatch=urlOriginRegExp.exec(startPage);if(!originMatch){console.error("Skipping extension with invalid URL: "+startPage);return false;}
6779 var extensionOrigin=originMatch[1];if(!this._registeredExtensions[extensionOrigin]){InspectorFrontendHost.setInjectedScriptForOrigin(extensionOrigin,buildExtensionAPIInjectedScript(extensionInfo));this._registeredExtensions[extensionOrigin]={name:name};}
6780 var iframe=document.createElement("iframe");iframe.src=startPage;iframe.style.display="none";document.body.appendChild(iframe);}catch(e){console.error("Failed to initialize extension "+startPage+":"+e);return false;}
6781 return true;},_onWindowMessage:function(event)
6782 {if(event.data==="registerExtension")
6783 this._registerExtension(event.origin,event.ports[0]);},_registerExtension:function(origin,port)
6784 {if(!this._registeredExtensions.hasOwnProperty(origin)){if(origin!==window.location.origin)
6785 console.error("Ignoring unauthorized client request from "+origin);return;}
6786 port._extensionOrigin=origin;port.addEventListener("message",this._onmessage.bind(this),false);port.start();},_onmessage:function(event)
6787 {var message=event.data;var result;if(message.command in this._handlers)
6788 result=this._handlers[message.command](message,event.target);else
6789 result=this._status.E_NOTSUPPORTED(message.command);if(result&&message.requestId)
6790 this._dispatchCallback(message.requestId,event.target,result);},_registerHandler:function(command,callback)
6791 {console.assert(command);this._handlers[command]=callback;},_registerSubscriptionHandler:function(eventTopic,onSubscribeFirst,onUnsubscribeLast)
6792 {this._subscriptionStartHandlers[eventTopic]=onSubscribeFirst;this._subscriptionStopHandlers[eventTopic]=onUnsubscribeLast;},_registerAutosubscriptionHandler:function(eventTopic,eventTarget,frontendEventType,handler)
6793 {this._registerSubscriptionHandler(eventTopic,eventTarget.addEventListener.bind(eventTarget,frontendEventType,handler,this),eventTarget.removeEventListener.bind(eventTarget,frontendEventType,handler,this));},_registerResourceContentCommittedHandler:function(handler)
6794 {function addFirstEventListener()
6795 {WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted,handler,this);WebInspector.workspace.setHasResourceContentTrackingExtensions(true);}
6796 function removeLastEventListener()
6797 {WebInspector.workspace.setHasResourceContentTrackingExtensions(false);WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted,handler,this);}
6798 this._registerSubscriptionHandler(WebInspector.extensionAPI.Events.ResourceContentCommitted,addFirstEventListener.bind(this),removeLastEventListener.bind(this));},_expandResourcePath:function(extensionPath,resourcePath)
6799 {if(!resourcePath)
6800 return;return extensionPath+this._normalizePath(resourcePath);},_normalizePath:function(path)
6801 {var source=path.split("/");var result=[];for(var i=0;i<source.length;++i){if(source[i]===".")
6802 continue;if(source[i]==="")
6803 continue;if(source[i]==="..")
6804 result.pop();else
6805 result.push(source[i]);}
6806 return"/"+result.join("/");},evaluate:function(expression,exposeCommandLineAPI,returnByValue,options,securityOrigin,callback)
6807 {var contextId;function resolveURLToFrame(url)
6808 {var found;function hasMatchingURL(frame)
6809 {found=(frame.url===url)?frame:null;return found;}
6810 WebInspector.resourceTreeModel.frames().some(hasMatchingURL);return found;}
6811 if(typeof options==="object"){var frame=options.frameURL?resolveURLToFrame(options.frameURL):WebInspector.resourceTreeModel.mainFrame;if(!frame){if(options.frameURL)
6812 console.warn("evaluate: there is no frame with URL "+options.frameURL);else
6813 console.warn("evaluate: the main frame is not yet available");return this._status.E_NOTFOUND(options.frameURL||"<top>");}
6814 var contextSecurityOrigin;if(options.useContentScriptContext)
6815 contextSecurityOrigin=securityOrigin;else if(options.scriptExecutionContext)
6816 contextSecurityOrigin=options.scriptExecutionContext;var frameContextList=WebInspector.runtimeModel.contextListByFrame(frame);var context;if(contextSecurityOrigin){context=frameContextList.contextBySecurityOrigin(contextSecurityOrigin);if(!context){console.warn("The JavaScript context "+contextSecurityOrigin+" was not found in the frame "+frame.url)
6817 return this._status.E_NOTFOUND(contextSecurityOrigin)}}else{context=frameContextList.mainWorldContext();if(!context)
6818 return this._status.E_FAILED(frame.url+" has no execution context");}
6819 contextId=context.id;}
6820 RuntimeAgent.evaluate(expression,"extension",exposeCommandLineAPI,true,contextId,returnByValue,false,callback);}}
6821 WebInspector.ExtensionServerPanelDescriptor=function(name,title,panel)
6822 {this._name=name;this._title=title;this._panel=panel;}
6823 WebInspector.ExtensionServerPanelDescriptor.prototype={name:function()
6824 {return this._name;},title:function()
6825 {return this._title;},panel:function()
6826 {return this._panel;}}
6827 WebInspector.ExtensionStatus=function()
6828 {function makeStatus(code,description)
6829 {var details=Array.prototype.slice.call(arguments,2);var status={code:code,description:description,details:details};if(code!=="OK"){status.isError=true;console.log("Extension server error: "+String.vsprintf(description,details));}
6830 return status;}
6831 this.OK=makeStatus.bind(null,"OK","OK");this.E_EXISTS=makeStatus.bind(null,"E_EXISTS","Object already exists: %s");this.E_BADARG=makeStatus.bind(null,"E_BADARG","Invalid argument %s: %s");this.E_BADARGTYPE=makeStatus.bind(null,"E_BADARGTYPE","Invalid type for argument %s: got %s, expected %s");this.E_NOTFOUND=makeStatus.bind(null,"E_NOTFOUND","Object not found: %s");this.E_NOTSUPPORTED=makeStatus.bind(null,"E_NOTSUPPORTED","Object does not support requested operation: %s");this.E_PROTOCOLERROR=makeStatus.bind(null,"E_PROTOCOLERROR","Inspector protocol error: %s");this.E_FAILED=makeStatus.bind(null,"E_FAILED","Operation failed: %s");}
6832 WebInspector.ExtensionStatus.Record;WebInspector.addExtensions=function(extensions)
6833 {WebInspector.extensionServer._addExtensions(extensions);}
6834 WebInspector.extensionAPI={};defineCommonExtensionSymbols(WebInspector.extensionAPI);WebInspector.extensionServer=new WebInspector.ExtensionServer();window.addExtension=function(page,name)
6835 {WebInspector.extensionServer._addExtension({startPage:page,name:name,});}
6836 WebInspector.ExtensionView=function(id,src,className)
6837 {WebInspector.View.call(this);this.element.className="extension-view";this._id=id;this._iframe=document.createElement("iframe");this._iframe.addEventListener("load",this._onLoad.bind(this),false);this._iframe.src=src;this._iframe.className=className;this.setDefaultFocusedElement(this._iframe);this.element.appendChild(this._iframe);}
6838 WebInspector.ExtensionView.prototype={wasShown:function()
6839 {if(typeof this._frameIndex==="number")
6840 WebInspector.extensionServer.notifyViewShown(this._id,this._frameIndex);},willHide:function()
6841 {if(typeof this._frameIndex==="number")
6842 WebInspector.extensionServer.notifyViewHidden(this._id);},_onLoad:function()
6843 {var frames=(window.frames);this._frameIndex=Array.prototype.indexOf.call(frames,this._iframe.contentWindow);if(this.isShowing())
6844 WebInspector.extensionServer.notifyViewShown(this._id,this._frameIndex);},__proto__:WebInspector.View.prototype}
6845 WebInspector.ExtensionNotifierView=function(id)
6846 {WebInspector.View.call(this);this._id=id;}
6847 WebInspector.ExtensionNotifierView.prototype={wasShown:function()
6848 {WebInspector.extensionServer.notifyViewShown(this._id);},willHide:function()
6849 {WebInspector.extensionServer.notifyViewHidden(this._id);},__proto__:WebInspector.View.prototype}
6850 WebInspector.ExtensionPanel=function(id,pageURL)
6851 {WebInspector.Panel.call(this,id);this.setHideOnDetach();this.element.classList.add("extension-panel");this._panelStatusBarElement=this.element.createChild("div","panel-status-bar hidden");this._searchableView=new WebInspector.SearchableView(this);this._searchableView.show(this.element);var extensionView=new WebInspector.ExtensionView(id,pageURL,"extension panel");extensionView.show(this._searchableView.element);this.setDefaultFocusedElement(extensionView.defaultFocusedElement());}
6852 WebInspector.ExtensionPanel.prototype={defaultFocusedElement:function()
6853 {return WebInspector.View.prototype.defaultFocusedElement.call(this);},addStatusBarItem:function(element)
6854 {this._panelStatusBarElement.classList.remove("hidden");this._panelStatusBarElement.appendChild(element);},searchCanceled:function()
6855 {WebInspector.extensionServer.notifySearchAction(this.name,WebInspector.extensionAPI.panels.SearchAction.CancelSearch);this._searchableView.updateSearchMatchesCount(0);},searchableView:function()
6856 {return this._searchableView;},performSearch:function(query,shouldJump)
6857 {WebInspector.extensionServer.notifySearchAction(this.name,WebInspector.extensionAPI.panels.SearchAction.PerformSearch,query);},jumpToNextSearchResult:function()
6858 {WebInspector.extensionServer.notifySearchAction(this.name,WebInspector.extensionAPI.panels.SearchAction.NextSearchResult);},jumpToPreviousSearchResult:function()
6859 {WebInspector.extensionServer.notifySearchAction(this.name,WebInspector.extensionAPI.panels.SearchAction.PreviousSearchResult);},__proto__:WebInspector.Panel.prototype}
6860 WebInspector.ExtensionButton=function(id,iconURL,tooltip,disabled)
6861 {this._id=id;this.element=document.createElement("button");this.element.className="status-bar-item extension";this.element.addEventListener("click",this._onClicked.bind(this),false);this.update(iconURL,tooltip,disabled);}
6862 WebInspector.ExtensionButton.prototype={update:function(iconURL,tooltip,disabled)
6863 {if(typeof iconURL==="string")
6864 this.element.style.backgroundImage="url("+iconURL+")";if(typeof tooltip==="string")
6865 this.element.title=tooltip;if(typeof disabled==="boolean")
6866 this.element.disabled=disabled;},_onClicked:function()
6867 {WebInspector.extensionServer.notifyButtonClicked(this._id);}}
6868 WebInspector.ExtensionSidebarPane=function(title,id)
6869 {WebInspector.SidebarPane.call(this,title);this.setHideOnDetach();this._id=id;}
6870 WebInspector.ExtensionSidebarPane.prototype={setObject:function(object,title,callback)
6871 {this._createObjectPropertiesView();this._setObject(WebInspector.RemoteObject.fromLocalObject(object),title,callback);},setExpression:function(expression,title,evaluateOptions,securityOrigin,callback)
6872 {this._createObjectPropertiesView();WebInspector.extensionServer.evaluate(expression,true,false,evaluateOptions,securityOrigin,this._onEvaluate.bind(this,title,callback));},setPage:function(url)
6873 {if(this._objectPropertiesView){this._objectPropertiesView.detach();delete this._objectPropertiesView;}
6874 if(this._extensionView)
6875 this._extensionView.detach(true);this._extensionView=new WebInspector.ExtensionView(this._id,url,"extension fill");this._extensionView.show(this.bodyElement);if(!this.bodyElement.style.height)
6876 this.setHeight("150px");},setHeight:function(height)
6877 {this.bodyElement.style.height=height;},_onEvaluate:function(title,callback,error,result,wasThrown)
6878 {if(error)
6879 callback(error.toString());else
6880 this._setObject(WebInspector.RemoteObject.fromPayload(result),title,callback);},_createObjectPropertiesView:function()
6881 {if(this._objectPropertiesView)
6882 return;if(this._extensionView){this._extensionView.detach(true);delete this._extensionView;}
6883 this._objectPropertiesView=new WebInspector.ExtensionNotifierView(this._id);this._objectPropertiesView.show(this.bodyElement);},_setObject:function(object,title,callback)
6884 {if(!this._objectPropertiesView){callback("operation cancelled");return;}
6885 this._objectPropertiesView.element.removeChildren();var section=new WebInspector.ObjectPropertiesSection(object,title);if(!title)
6886 section.headerElement.classList.add("hidden");section.expanded=true;section.editable=false;this._objectPropertiesView.element.appendChild(section.element);callback();},__proto__:WebInspector.SidebarPane.prototype}
6887 WebInspector.EmptyView=function(text)
6888 {WebInspector.View.call(this);this._text=text;}
6889 WebInspector.EmptyView.prototype={wasShown:function()
6890 {this.element.className="empty-view";this.element.textContent=this._text;},set text(text)
6891 {this._text=text;if(this.isShowing())
6892 this.element.textContent=this._text;},__proto__:WebInspector.View.prototype}
6893 WebInspector.Formatter=function()
6894 {}
6895 WebInspector.Formatter.createFormatter=function(contentType)
6896 {if(contentType===WebInspector.resourceTypes.Script||contentType===WebInspector.resourceTypes.Document||contentType===WebInspector.resourceTypes.Stylesheet)
6897 return new WebInspector.ScriptFormatter();return new WebInspector.IdentityFormatter();}
6898 WebInspector.Formatter.locationToPosition=function(lineEndings,lineNumber,columnNumber)
6899 {var position=lineNumber?lineEndings[lineNumber-1]+1:0;return position+columnNumber;}
6900 WebInspector.Formatter.positionToLocation=function(lineEndings,position)
6901 {var lineNumber=lineEndings.upperBound(position-1);if(!lineNumber)
6902 var columnNumber=position;else
6903 var columnNumber=position-lineEndings[lineNumber-1]-1;return[lineNumber,columnNumber];}
6904 WebInspector.Formatter.prototype={formatContent:function(mimeType,content,callback)
6905 {}}
6906 WebInspector.ScriptFormatter=function()
6907 {this._tasks=[];}
6908 WebInspector.ScriptFormatter.prototype={formatContent:function(mimeType,content,callback)
6909 {content=content.replace(/\r\n?|[\n\u2028\u2029]/g,"\n").replace(/^\uFEFF/,'');const method="format";var parameters={mimeType:mimeType,content:content,indentString:WebInspector.settings.textEditorIndent.get()};this._tasks.push({data:parameters,callback:callback});this._worker.postMessage({method:method,params:parameters});},_didFormatContent:function(event)
6910 {var task=this._tasks.shift();var originalContent=task.data.content;var formattedContent=event.data.content;var mapping=event.data["mapping"];var sourceMapping=new WebInspector.FormatterSourceMappingImpl(originalContent.lineEndings(),formattedContent.lineEndings(),mapping);task.callback(formattedContent,sourceMapping);},get _worker()
6911 {if(!this._cachedWorker){this._cachedWorker=new Worker("ScriptFormatterWorker.js");this._cachedWorker.onmessage=(this._didFormatContent.bind(this));}
6912 return this._cachedWorker;}}
6913 WebInspector.IdentityFormatter=function()
6914 {this._tasks=[];}
6915 WebInspector.IdentityFormatter.prototype={formatContent:function(mimeType,content,callback)
6916 {callback(content,new WebInspector.IdentityFormatterSourceMapping());}}
6917 WebInspector.FormatterMappingPayload=function()
6918 {this.original=[];this.formatted=[];}
6919 WebInspector.FormatterSourceMapping=function()
6920 {}
6921 WebInspector.FormatterSourceMapping.prototype={originalToFormatted:function(lineNumber,columnNumber){},formattedToOriginal:function(lineNumber,columnNumber){}}
6922 WebInspector.IdentityFormatterSourceMapping=function()
6923 {}
6924 WebInspector.IdentityFormatterSourceMapping.prototype={originalToFormatted:function(lineNumber,columnNumber)
6925 {return[lineNumber,columnNumber||0];},formattedToOriginal:function(lineNumber,columnNumber)
6926 {return[lineNumber,columnNumber||0];}}
6927 WebInspector.FormatterSourceMappingImpl=function(originalLineEndings,formattedLineEndings,mapping)
6928 {this._originalLineEndings=originalLineEndings;this._formattedLineEndings=formattedLineEndings;this._mapping=mapping;}
6929 WebInspector.FormatterSourceMappingImpl.prototype={originalToFormatted:function(lineNumber,columnNumber)
6930 {var originalPosition=WebInspector.Formatter.locationToPosition(this._originalLineEndings,lineNumber,columnNumber||0);var formattedPosition=this._convertPosition(this._mapping.original,this._mapping.formatted,originalPosition||0);return WebInspector.Formatter.positionToLocation(this._formattedLineEndings,formattedPosition);},formattedToOriginal:function(lineNumber,columnNumber)
6931 {var formattedPosition=WebInspector.Formatter.locationToPosition(this._formattedLineEndings,lineNumber,columnNumber||0);var originalPosition=this._convertPosition(this._mapping.formatted,this._mapping.original,formattedPosition);return WebInspector.Formatter.positionToLocation(this._originalLineEndings,originalPosition||0);},_convertPosition:function(positions1,positions2,position)
6932 {var index=positions1.upperBound(position)-1;var convertedPosition=positions2[index]+position-positions1[index];if(index<positions2.length-1&&convertedPosition>positions2[index+1])
6933 convertedPosition=positions2[index+1];return convertedPosition;}}
6934 WebInspector.DOMSyntaxHighlighter=function(mimeType,stripExtraWhitespace)
6935 {loadScript("CodeMirrorTextEditor.js");this._mimeType=mimeType;this._stripExtraWhitespace=stripExtraWhitespace;}
6936 WebInspector.DOMSyntaxHighlighter.prototype={createSpan:function(content,className)
6937 {var span=document.createElement("span");span.className="cm-"+className;if(this._stripExtraWhitespace&&className!=="whitespace")
6938 content=content.replace(/^[\n\r]*/,"").replace(/\s*$/,"");span.appendChild(document.createTextNode(content));return span;},syntaxHighlightNode:function(node)
6939 {var lines=node.textContent.split("\n");node.removeChildren();function processToken(token,tokenType,column,newColumn)
6940 {if(!tokenType)
6941 return;if(column>plainTextStart){var plainText=line.substring(plainTextStart,column);node.appendChild(document.createTextNode(plainText));}
6942 node.appendChild(this.createSpan(token,tokenType));plainTextStart=newColumn;}
6943 var tokenize=WebInspector.CodeMirrorUtils.createTokenizer(this._mimeType);for(var i=lines[0].length?0:1;i<lines.length;++i){var line=lines[i];var plainTextStart=0;tokenize(line,processToken.bind(this));if(plainTextStart<line.length){var plainText=line.substring(plainTextStart,line.length);node.appendChild(document.createTextNode(plainText));}
6944 if(i<lines.length-1)
6945 node.appendChild(document.createElement("br"));}}}
6946 window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem;WebInspector.TempFile=function(dirPath,name,callback)
6947 {this._fileEntry=null;this._writer=null;function didInitFs(fs)
6948 {fs.root.getDirectory(dirPath,{create:true},didGetDir.bind(this),boundErrorHandler);}
6949 function didGetDir(dir)
6950 {dir.getFile(name,{create:true},didCreateFile.bind(this),boundErrorHandler);}
6951 function didCreateFile(fileEntry)
6952 {this._fileEntry=fileEntry;fileEntry.createWriter(didCreateWriter.bind(this),boundErrorHandler);}
6953 function didCreateWriter(writer)
6954 {function didTruncate(e)
6955 {this._writer=writer;writer.onwrite=null;writer.onerror=null;callback(this);}
6956 function onTruncateError(e)
6957 {WebInspector.log("Failed to truncate temp file "+e.code+" : "+e.message,WebInspector.ConsoleMessage.MessageLevel.Error);callback(null);}
6958 if(writer.length){writer.onwrite=didTruncate.bind(this);writer.onerror=onTruncateError.bind(this);writer.truncate(0);}else{this._writer=writer;callback(this);}}
6959 function errorHandler(e)
6960 {WebInspector.log("Failed to create temp file "+e.code+" : "+e.message,WebInspector.ConsoleMessage.MessageLevel.Error);callback(null);}
6961 var boundErrorHandler=errorHandler.bind(this)
6962 function didClearTempStorage()
6963 {window.requestFileSystem(window.TEMPORARY,10,didInitFs.bind(this),boundErrorHandler);}
6964 WebInspector.TempFile._ensureTempStorageCleared(didClearTempStorage.bind(this));}
6965 WebInspector.TempFile.prototype={write:function(data,callback)
6966 {var blob=new Blob([data],{type:'text/plain'});this._writer.onerror=function(e)
6967 {WebInspector.log("Failed to write into a temp file: "+e.message,WebInspector.ConsoleMessage.MessageLevel.Error);callback(false);}
6968 this._writer.onwrite=function(e)
6969 {callback(true);}
6970 this._writer.write(blob);},finishWriting:function()
6971 {this._writer=null;},read:function(callback)
6972 {function didGetFile(file)
6973 {var reader=new FileReader();reader.onloadend=function(e)
6974 {callback((this.result));}
6975 reader.onerror=function(error)
6976 {WebInspector.log("Failed to read from temp file: "+error.message,WebInspector.ConsoleMessage.MessageLevel.Error);}
6977 reader.readAsText(file);}
6978 function didFailToGetFile(error)
6979 {WebInspector.log("Failed to load temp file: "+error.message,WebInspector.ConsoleMessage.MessageLevel.Error);callback(null);}
6980 this._fileEntry.file(didGetFile.bind(this),didFailToGetFile.bind(this));},writeToOutputSteam:function(outputStream,delegate)
6981 {function didGetFile(file)
6982 {var reader=new WebInspector.ChunkedFileReader(file,10*1000*1000,delegate);reader.start(outputStream);}
6983 function didFailToGetFile(error)
6984 {WebInspector.log("Failed to load temp file: "+error.message,WebInspector.ConsoleMessage.MessageLevel.Error);outputStream.close();}
6985 this._fileEntry.file(didGetFile.bind(this),didFailToGetFile.bind(this));},remove:function()
6986 {if(this._fileEntry)
6987 this._fileEntry.remove(function(){});}}
6988 WebInspector.BufferedTempFileWriter=function(dirPath,name)
6989 {this._chunks=[];this._tempFile=null;this._isWriting=false;this._finishCallback=null;this._isFinished=false;new WebInspector.TempFile(dirPath,name,this._didCreateTempFile.bind(this));}
6990 WebInspector.BufferedTempFileWriter.prototype={write:function(data)
6991 {if(!this._chunks)
6992 return;if(this._finishCallback)
6993 throw new Error("Now writes are allowed after close.");this._chunks.push(data);if(this._tempFile&&!this._isWriting)
6994 this._writeNextChunk();},close:function(callback)
6995 {this._finishCallback=callback;if(this._isFinished)
6996 callback(this._tempFile);else if(!this._isWriting&&!this._chunks.length)
6997 this._notifyFinished();},_didCreateTempFile:function(tempFile)
6998 {this._tempFile=tempFile;if(!tempFile){this._chunks=null;this._notifyFinished();return;}
6999 if(this._chunks.length)
7000 this._writeNextChunk();},_writeNextChunk:function()
7001 {var chunkSize=0;var endIndex=0;for(;endIndex<this._chunks.length;endIndex++){chunkSize+=this._chunks[endIndex].length;if(chunkSize>10*1000*1000)
7002 break;}
7003 var chunk=this._chunks.slice(0,endIndex+1).join("");this._chunks.splice(0,endIndex+1);this._isWriting=true;this._tempFile.write(chunk,this._didWriteChunk.bind(this));},_didWriteChunk:function(success)
7004 {this._isWriting=false;if(!success){this._tempFile=null;this._chunks=null;this._notifyFinished();return;}
7005 if(this._chunks.length)
7006 this._writeNextChunk();else if(this._finishCallback)
7007 this._notifyFinished();},_notifyFinished:function()
7008 {this._isFinished=true;if(this._tempFile)
7009 this._tempFile.finishWriting();if(this._finishCallback)
7010 this._finishCallback(this._tempFile);}}
7011 WebInspector.TempStorageCleaner=function()
7012 {this._worker=new SharedWorker("TempStorageSharedWorker.js","TempStorage");this._callbacks=[];this._worker.port.onmessage=this._handleMessage.bind(this);this._worker.port.onerror=this._handleError.bind(this);}
7013 WebInspector.TempStorageCleaner.prototype={ensureStorageCleared:function(callback)
7014 {if(this._callbacks)
7015 this._callbacks.push(callback);else
7016 callback();},_handleMessage:function(event)
7017 {if(event.data.type==="tempStorageCleared"){if(event.data.error)
7018 WebInspector.log(event.data.error,WebInspector.ConsoleMessage.MessageLevel.Error);this._notifyCallbacks();}},_handleError:function(event)
7019 {WebInspector.log(WebInspector.UIString("Failed to clear temp storage: %s",event.data),WebInspector.ConsoleMessage.MessageLevel.Error);this._notifyCallbacks();},_notifyCallbacks:function()
7020 {var callbacks=this._callbacks;this._callbacks=null;for(var i=0;i<callbacks.length;i++)
7021 callbacks[i]();}}
7022 WebInspector.TempFile._ensureTempStorageCleared=function(callback)
7023 {if(!WebInspector.TempFile._storageCleaner)
7024 WebInspector.TempFile._storageCleaner=new WebInspector.TempStorageCleaner();WebInspector.TempFile._storageCleaner.ensureStorageCleared(callback);}
7025 WebInspector.TextRange=function(startLine,startColumn,endLine,endColumn)
7026 {this.startLine=startLine;this.startColumn=startColumn;this.endLine=endLine;this.endColumn=endColumn;}
7027 WebInspector.TextRange.createFromLocation=function(line,column)
7028 {return new WebInspector.TextRange(line,column,line,column);}
7029 WebInspector.TextRange.fromObject=function(serializedTextRange)
7030 {return new WebInspector.TextRange(serializedTextRange.startLine,serializedTextRange.startColumn,serializedTextRange.endLine,serializedTextRange.endColumn);}
7031 WebInspector.TextRange.prototype={isEmpty:function()
7032 {return this.startLine===this.endLine&&this.startColumn===this.endColumn;},immediatelyPrecedes:function(range)
7033 {if(!range)
7034 return false;return this.endLine===range.startLine&&this.endColumn===range.startColumn;},immediatelyFollows:function(range)
7035 {if(!range)
7036 return false;return range.immediatelyPrecedes(this);},get linesCount()
7037 {return this.endLine-this.startLine;},collapseToEnd:function()
7038 {return new WebInspector.TextRange(this.endLine,this.endColumn,this.endLine,this.endColumn);},normalize:function()
7039 {if(this.startLine>this.endLine||(this.startLine===this.endLine&&this.startColumn>this.endColumn))
7040 return new WebInspector.TextRange(this.endLine,this.endColumn,this.startLine,this.startColumn);else
7041 return this.clone();},clone:function()
7042 {return new WebInspector.TextRange(this.startLine,this.startColumn,this.endLine,this.endColumn);},serializeToObject:function()
7043 {var serializedTextRange={};serializedTextRange.startLine=this.startLine;serializedTextRange.startColumn=this.startColumn;serializedTextRange.endLine=this.endLine;serializedTextRange.endColumn=this.endColumn;return serializedTextRange;},compareTo:function(other)
7044 {if(this.startLine>other.startLine)
7045 return 1;if(this.startLine<other.startLine)
7046 return-1;if(this.startColumn>other.startColumn)
7047 return 1;if(this.startColumn<other.startColumn)
7048 return-1;return 0;},equal:function(other)
7049 {return this.startLine===other.startLine&&this.endLine===other.endLine&&this.startColumn===other.startColumn&&this.endColumn===other.endColumn;},shift:function(lineOffset)
7050 {return new WebInspector.TextRange(this.startLine+lineOffset,this.startColumn,this.endLine+lineOffset,this.endColumn);},toString:function()
7051 {return JSON.stringify(this);}}
7052 WebInspector.SourceRange=function(offset,length)
7053 {this.offset=offset;this.length=length;}
7054 WebInspector.TextUtils={isStopChar:function(char)
7055 {return(char>" "&&char<"0")||(char>"9"&&char<"A")||(char>"Z"&&char<"_")||(char>"_"&&char<"a")||(char>"z"&&char<="~");},isWordChar:function(char)
7056 {return!WebInspector.TextUtils.isStopChar(char)&&!WebInspector.TextUtils.isSpaceChar(char);},isSpaceChar:function(char)
7057 {return WebInspector.TextUtils._SpaceCharRegex.test(char);},isWord:function(word)
7058 {for(var i=0;i<word.length;++i){if(!WebInspector.TextUtils.isWordChar(word.charAt(i)))
7059 return false;}
7060 return true;},isOpeningBraceChar:function(char)
7061 {return char==="("||char==="{";},isClosingBraceChar:function(char)
7062 {return char===")"||char==="}";},isBraceChar:function(char)
7063 {return WebInspector.TextUtils.isOpeningBraceChar(char)||WebInspector.TextUtils.isClosingBraceChar(char);},textToWords:function(text)
7064 {var words=[];var startWord=-1;for(var i=0;i<text.length;++i){if(!WebInspector.TextUtils.isWordChar(text.charAt(i))){if(startWord!==-1)
7065 words.push(text.substring(startWord,i));startWord=-1;}else if(startWord===-1)
7066 startWord=i;}
7067 if(startWord!==-1)
7068 words.push(text.substring(startWord));return words;},findBalancedCurlyBrackets:function(source,startIndex,lastIndex){lastIndex=lastIndex||source.length;startIndex=startIndex||0;var counter=0;var inString=false;for(var index=startIndex;index<lastIndex;++index){var character=source[index];if(inString){if(character==="\\")
7069 ++index;else if(character==="\"")
7070 inString=false;}else{if(character==="\"")
7071 inString=true;else if(character==="{")
7072 ++counter;else if(character==="}"){if(--counter===0)
7073 return index+1;}}}
7074 return-1;}}
7075 WebInspector.TextUtils._SpaceCharRegex=/\s/;WebInspector.TextUtils.Indent={TwoSpaces:"  ",FourSpaces:"    ",EightSpaces:"        ",TabCharacter:"\t"}
7076 WebInspector.FileSystemModel=function()
7077 {WebInspector.Object.call(this);this._fileSystemsForOrigin={};WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);FileSystemAgent.enable();this._reset();}
7078 WebInspector.FileSystemModel.prototype={_reset:function()
7079 {for(var securityOrigin in this._fileSystemsForOrigin)
7080 this._removeOrigin(securityOrigin);var securityOrigins=WebInspector.resourceTreeModel.securityOrigins();for(var i=0;i<securityOrigins.length;++i)
7081 this._addOrigin(securityOrigins[i]);},_securityOriginAdded:function(event)
7082 {var securityOrigin=(event.data);this._addOrigin(securityOrigin);},_securityOriginRemoved:function(event)
7083 {var securityOrigin=(event.data);this._removeOrigin(securityOrigin);},_addOrigin:function(securityOrigin)
7084 {this._fileSystemsForOrigin[securityOrigin]={};var types=["persistent","temporary"];for(var i=0;i<types.length;++i)
7085 this._requestFileSystemRoot(securityOrigin,types[i],this._fileSystemRootReceived.bind(this,securityOrigin,types[i],this._fileSystemsForOrigin[securityOrigin]));},_removeOrigin:function(securityOrigin)
7086 {for(var type in this._fileSystemsForOrigin[securityOrigin]){var fileSystem=this._fileSystemsForOrigin[securityOrigin][type];delete this._fileSystemsForOrigin[securityOrigin][type];this._fileSystemRemoved(fileSystem);}
7087 delete this._fileSystemsForOrigin[securityOrigin];},_requestFileSystemRoot:function(origin,type,callback)
7088 {function innerCallback(error,errorCode,backendRootEntry)
7089 {if(error){callback(FileError.SECURITY_ERR);return;}
7090 callback(errorCode,backendRootEntry);}
7091 FileSystemAgent.requestFileSystemRoot(origin,type,innerCallback.bind(this));},_fileSystemAdded:function(fileSystem)
7092 {this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemAdded,fileSystem);},_fileSystemRemoved:function(fileSystem)
7093 {this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemRemoved,fileSystem);},refreshFileSystemList:function()
7094 {this._reset();},_fileSystemRootReceived:function(origin,type,store,errorCode,backendRootEntry)
7095 {if(!errorCode&&backendRootEntry&&this._fileSystemsForOrigin[origin]===store){var fileSystem=new WebInspector.FileSystemModel.FileSystem(this,origin,type,backendRootEntry);store[type]=fileSystem;this._fileSystemAdded(fileSystem);}},requestDirectoryContent:function(directory,callback)
7096 {this._requestDirectoryContent(directory.url,this._directoryContentReceived.bind(this,directory,callback));},_requestDirectoryContent:function(url,callback)
7097 {function innerCallback(error,errorCode,backendEntries)
7098 {if(error){callback(FileError.SECURITY_ERR);return;}
7099 if(errorCode!==0){callback(errorCode);return;}
7100 callback(errorCode,backendEntries);}
7101 FileSystemAgent.requestDirectoryContent(url,innerCallback.bind(this));},_directoryContentReceived:function(parentDirectory,callback,errorCode,backendEntries)
7102 {if(!backendEntries){callback(errorCode);return;}
7103 var entries=[];for(var i=0;i<backendEntries.length;++i){if(backendEntries[i].isDirectory)
7104 entries.push(new WebInspector.FileSystemModel.Directory(this,parentDirectory.fileSystem,backendEntries[i]));else
7105 entries.push(new WebInspector.FileSystemModel.File(this,parentDirectory.fileSystem,backendEntries[i]));}
7106 callback(errorCode,entries);},requestMetadata:function(entry,callback)
7107 {function innerCallback(error,errorCode,metadata)
7108 {if(error){callback(FileError.SECURITY_ERR);return;}
7109 callback(errorCode,metadata);}
7110 FileSystemAgent.requestMetadata(entry.url,innerCallback.bind(this));},requestFileContent:function(file,readAsText,start,end,charset,callback)
7111 {this._requestFileContent(file.url,readAsText,start,end,charset,callback);},_requestFileContent:function(url,readAsText,start,end,charset,callback)
7112 {function innerCallback(error,errorCode,content,charset)
7113 {if(error){if(callback)
7114 callback(FileError.SECURITY_ERR);return;}
7115 if(callback)
7116 callback(errorCode,content,charset);}
7117 FileSystemAgent.requestFileContent(url,readAsText,start,end,charset,innerCallback.bind(this));},deleteEntry:function(entry,callback)
7118 {var fileSystemModel=this;if(entry===entry.fileSystem.root)
7119 this._deleteEntry(entry.url,hookFileSystemDeletion);else
7120 this._deleteEntry(entry.url,callback);function hookFileSystemDeletion(errorCode)
7121 {callback(errorCode);if(!errorCode)
7122 fileSystemModel._removeFileSystem(entry.fileSystem);}},_deleteEntry:function(url,callback)
7123 {function innerCallback(error,errorCode)
7124 {if(error){if(callback)
7125 callback(FileError.SECURITY_ERR);return;}
7126 if(callback)
7127 callback(errorCode);}
7128 FileSystemAgent.deleteEntry(url,innerCallback.bind(this));},_removeFileSystem:function(fileSystem)
7129 {var origin=fileSystem.origin;var type=fileSystem.type;if(this._fileSystemsForOrigin[origin]&&this._fileSystemsForOrigin[origin][type]){delete this._fileSystemsForOrigin[origin][type];this._fileSystemRemoved(fileSystem);if(Object.isEmpty(this._fileSystemsForOrigin[origin]))
7130 delete this._fileSystemsForOrigin[origin];}},__proto__:WebInspector.Object.prototype}
7131 WebInspector.FileSystemModel.EventTypes={FileSystemAdded:"FileSystemAdded",FileSystemRemoved:"FileSystemRemoved"}
7132 WebInspector.FileSystemModel.FileSystem=function(fileSystemModel,origin,type,backendRootEntry)
7133 {this.origin=origin;this.type=type;this.root=new WebInspector.FileSystemModel.Directory(fileSystemModel,this,backendRootEntry);}
7134 WebInspector.FileSystemModel.FileSystem.prototype={get name()
7135 {return"filesystem:"+this.origin+"/"+this.type;}}
7136 WebInspector.FileSystemModel.Entry=function(fileSystemModel,fileSystem,backendEntry)
7137 {this._fileSystemModel=fileSystemModel;this._fileSystem=fileSystem;this._url=backendEntry.url;this._name=backendEntry.name;this._isDirectory=backendEntry.isDirectory;}
7138 WebInspector.FileSystemModel.Entry.compare=function(x,y)
7139 {if(x.isDirectory!=y.isDirectory)
7140 return y.isDirectory?1:-1;return x.name.compareTo(y.name);}
7141 WebInspector.FileSystemModel.Entry.prototype={get fileSystemModel()
7142 {return this._fileSystemModel;},get fileSystem()
7143 {return this._fileSystem;},get url()
7144 {return this._url;},get name()
7145 {return this._name;},get isDirectory()
7146 {return this._isDirectory;},requestMetadata:function(callback)
7147 {this.fileSystemModel.requestMetadata(this,callback);},deleteEntry:function(callback)
7148 {this.fileSystemModel.deleteEntry(this,callback);}}
7149 WebInspector.FileSystemModel.Directory=function(fileSystemModel,fileSystem,backendEntry)
7150 {WebInspector.FileSystemModel.Entry.call(this,fileSystemModel,fileSystem,backendEntry);}
7151 WebInspector.FileSystemModel.Directory.prototype={requestDirectoryContent:function(callback)
7152 {this.fileSystemModel.requestDirectoryContent(this,callback);},__proto__:WebInspector.FileSystemModel.Entry.prototype}
7153 WebInspector.FileSystemModel.File=function(fileSystemModel,fileSystem,backendEntry)
7154 {WebInspector.FileSystemModel.Entry.call(this,fileSystemModel,fileSystem,backendEntry);this._mimeType=backendEntry.mimeType;this._resourceType=WebInspector.resourceTypes[backendEntry.resourceType];this._isTextFile=backendEntry.isTextFile;}
7155 WebInspector.FileSystemModel.File.prototype={get mimeType()
7156 {return this._mimeType;},get resourceType()
7157 {return this._resourceType;},get isTextFile()
7158 {return this._isTextFile;},requestFileContent:function(readAsText,start,end,charset,callback)
7159 {this.fileSystemModel.requestFileContent(this,readAsText,start,end,charset,callback);},__proto__:WebInspector.FileSystemModel.Entry.prototype}
7160 WebInspector.OutputStreamDelegate=function()
7161 {}
7162 WebInspector.OutputStreamDelegate.prototype={onTransferStarted:function(){},onTransferFinished:function(){},onChunkTransferred:function(reader){},onError:function(reader,event){},}
7163 WebInspector.OutputStream=function()
7164 {}
7165 WebInspector.OutputStream.prototype={write:function(data,callback){},close:function(){}}
7166 WebInspector.ChunkedReader=function()
7167 {}
7168 WebInspector.ChunkedReader.prototype={fileSize:function(){},loadedSize:function(){},fileName:function(){},cancel:function(){}}
7169 WebInspector.ChunkedFileReader=function(file,chunkSize,delegate)
7170 {this._file=file;this._fileSize=file.size;this._loadedSize=0;this._chunkSize=chunkSize;this._delegate=delegate;this._isCanceled=false;}
7171 WebInspector.ChunkedFileReader.prototype={start:function(output)
7172 {this._output=output;this._reader=new FileReader();this._reader.onload=this._onChunkLoaded.bind(this);this._reader.onerror=this._delegate.onError.bind(this._delegate,this);this._delegate.onTransferStarted();this._loadChunk();},cancel:function()
7173 {this._isCanceled=true;},loadedSize:function()
7174 {return this._loadedSize;},fileSize:function()
7175 {return this._fileSize;},fileName:function()
7176 {return this._file.name;},_onChunkLoaded:function(event)
7177 {if(this._isCanceled)
7178 return;if(event.target.readyState!==FileReader.DONE)
7179 return;var data=event.target.result;this._loadedSize+=data.length;this._output.write(data);if(this._isCanceled)
7180 return;this._delegate.onChunkTransferred(this);if(this._loadedSize===this._fileSize){this._file=null;this._reader=null;this._output.close();this._delegate.onTransferFinished();return;}
7181 this._loadChunk();},_loadChunk:function()
7182 {var chunkStart=this._loadedSize;var chunkEnd=Math.min(this._fileSize,chunkStart+this._chunkSize)
7183 var nextPart=this._file.slice(chunkStart,chunkEnd);this._reader.readAsText(nextPart);}}
7184 WebInspector.ChunkedXHRReader=function(url,delegate)
7185 {this._url=url;this._delegate=delegate;this._fileSize=0;this._loadedSize=0;this._isCanceled=false;}
7186 WebInspector.ChunkedXHRReader.prototype={start:function(output)
7187 {this._output=output;this._xhr=new XMLHttpRequest();this._xhr.open("GET",this._url,true);this._xhr.onload=this._onLoad.bind(this);this._xhr.onprogress=this._onProgress.bind(this);this._xhr.onerror=this._delegate.onError.bind(this._delegate,this);this._xhr.send(null);this._delegate.onTransferStarted();},cancel:function()
7188 {this._isCanceled=true;this._xhr.abort();},loadedSize:function()
7189 {return this._loadedSize;},fileSize:function()
7190 {return this._fileSize;},fileName:function()
7191 {return this._url;},_onProgress:function(event)
7192 {if(this._isCanceled)
7193 return;if(event.lengthComputable)
7194 this._fileSize=event.total;var data=this._xhr.responseText.substring(this._loadedSize);if(!data.length)
7195 return;this._loadedSize+=data.length;this._output.write(data);if(this._isCanceled)
7196 return;this._delegate.onChunkTransferred(this);},_onLoad:function(event)
7197 {this._onProgress(event);if(this._isCanceled)
7198 return;this._output.close();this._delegate.onTransferFinished();}}
7199 WebInspector.createFileSelectorElement=function(callback){var fileSelectorElement=document.createElement("input");fileSelectorElement.type="file";fileSelectorElement.style.display="none";fileSelectorElement.setAttribute("tabindex",-1);fileSelectorElement.onchange=onChange;function onChange(event)
7200 {callback(fileSelectorElement.files[0]);};return fileSelectorElement;}
7201 WebInspector.FileOutputStream=function()
7202 {}
7203 WebInspector.FileOutputStream.prototype={open:function(fileName,callback)
7204 {this._closed=false;this._writeCallbacks=[];this._fileName=fileName;function callbackWrapper(accepted)
7205 {if(accepted)
7206 WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);callback(accepted);}
7207 WebInspector.fileManager.save(this._fileName,"",true,callbackWrapper.bind(this));},write:function(data,callback)
7208 {this._writeCallbacks.push(callback);WebInspector.fileManager.append(this._fileName,data);},close:function()
7209 {this._closed=true;if(this._writeCallbacks.length)
7210 return;WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);WebInspector.fileManager.close(this._fileName);},_onAppendDone:function(event)
7211 {if(event.data!==this._fileName)
7212 return;var callback=this._writeCallbacks.shift();if(callback)
7213 callback(this);if(!this._writeCallbacks.length){if(this._closed){WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);WebInspector.fileManager.close(this._fileName);}}}}
7214 WebInspector.DebuggerModel=function()
7215 {InspectorBackend.registerDebuggerDispatcher(new WebInspector.DebuggerDispatcher(this));this._debuggerPausedDetails=null;this._scripts={};this._scriptsBySourceURL={};this._breakpointsActive=true;WebInspector.settings.pauseOnExceptionStateString=WebInspector.settings.createSetting("pauseOnExceptionStateString",WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions);WebInspector.settings.pauseOnExceptionStateString.addChangeListener(this._pauseOnExceptionStateChanged,this);WebInspector.settings.lastPauseOnExceptionState=WebInspector.settings.createSetting("lastPauseOnExceptionState",WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions);WebInspector.settings.enableAsyncStackTraces.addChangeListener(this._asyncStackTracesStateChanged,this);this.enableDebugger();WebInspector.DebuggerModel.applySkipStackFrameSettings();}
7216 WebInspector.DebuggerModel.PauseOnExceptionsState={DontPauseOnExceptions:"none",PauseOnAllExceptions:"all",PauseOnUncaughtExceptions:"uncaught"};WebInspector.DebuggerModel.Location=function(scriptId,lineNumber,columnNumber)
7217 {this.scriptId=scriptId;this.lineNumber=lineNumber;this.columnNumber=columnNumber;}
7218 WebInspector.DebuggerModel.Events={DebuggerWasEnabled:"DebuggerWasEnabled",DebuggerWasDisabled:"DebuggerWasDisabled",DebuggerPaused:"DebuggerPaused",DebuggerResumed:"DebuggerResumed",ParsedScriptSource:"ParsedScriptSource",FailedToParseScriptSource:"FailedToParseScriptSource",BreakpointResolved:"BreakpointResolved",GlobalObjectCleared:"GlobalObjectCleared",CallFrameSelected:"CallFrameSelected",ConsoleCommandEvaluatedInSelectedCallFrame:"ConsoleCommandEvaluatedInSelectedCallFrame",BreakpointsActiveStateChanged:"BreakpointsActiveStateChanged"}
7219 WebInspector.DebuggerModel.BreakReason={DOM:"DOM",EventListener:"EventListener",XHR:"XHR",Exception:"exception",Assert:"assert",CSPViolation:"CSPViolation",DebugCommand:"debugCommand"}
7220 WebInspector.DebuggerModel.prototype={debuggerEnabled:function()
7221 {return!!this._debuggerEnabled;},enableDebugger:function()
7222 {if(this._debuggerEnabled)
7223 return;DebuggerAgent.enable(this._debuggerWasEnabled.bind(this));},disableDebugger:function()
7224 {if(!this._debuggerEnabled)
7225 return;DebuggerAgent.disable(this._debuggerWasDisabled.bind(this));},skipAllPauses:function(skip,untilReload)
7226 {if(this._skipAllPausesTimeout){clearTimeout(this._skipAllPausesTimeout);delete this._skipAllPausesTimeout;}
7227 DebuggerAgent.setSkipAllPauses(skip,untilReload);},skipAllPausesUntilReloadOrTimeout:function(timeout)
7228 {if(this._skipAllPausesTimeout)
7229 clearTimeout(this._skipAllPausesTimeout);DebuggerAgent.setSkipAllPauses(true,true);this._skipAllPausesTimeout=setTimeout(this.skipAllPauses.bind(this,false),timeout);},_debuggerWasEnabled:function()
7230 {this._debuggerEnabled=true;this._pauseOnExceptionStateChanged();this._asyncStackTracesStateChanged();this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasEnabled);},_pauseOnExceptionStateChanged:function()
7231 {DebuggerAgent.setPauseOnExceptions(WebInspector.settings.pauseOnExceptionStateString.get());},_asyncStackTracesStateChanged:function()
7232 {const maxAsyncStackChainDepth=4;var enabled=WebInspector.settings.enableAsyncStackTraces.get();DebuggerAgent.setAsyncCallStackDepth(enabled?maxAsyncStackChainDepth:0);},_debuggerWasDisabled:function()
7233 {this._debuggerEnabled=false;this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasDisabled);},continueToLocation:function(rawLocation)
7234 {DebuggerAgent.continueToLocation(rawLocation);},stepIntoSelection:function(rawLocation)
7235 {function callback(requestedLocation,error)
7236 {if(error)
7237 return;this._pendingStepIntoLocation=requestedLocation;};DebuggerAgent.continueToLocation(rawLocation,true,callback.bind(this,rawLocation));},stepInto:function()
7238 {function callback()
7239 {DebuggerAgent.stepInto();}
7240 DebuggerAgent.setOverlayMessage(undefined,callback.bind(this));},stepOver:function()
7241 {function callback()
7242 {DebuggerAgent.stepOver();}
7243 DebuggerAgent.setOverlayMessage(undefined,callback.bind(this));},stepOut:function()
7244 {function callback()
7245 {DebuggerAgent.stepOut();}
7246 DebuggerAgent.setOverlayMessage(undefined,callback.bind(this));},resume:function()
7247 {function callback()
7248 {DebuggerAgent.resume();}
7249 DebuggerAgent.setOverlayMessage(undefined,callback.bind(this));},setBreakpointByScriptLocation:function(rawLocation,condition,callback)
7250 {var script=this.scriptForId(rawLocation.scriptId);if(script.sourceURL)
7251 this.setBreakpointByURL(script.sourceURL,rawLocation.lineNumber,rawLocation.columnNumber,condition,callback);else
7252 this.setBreakpointBySourceId(rawLocation,condition,callback);},setBreakpointByURL:function(url,lineNumber,columnNumber,condition,callback)
7253 {var minColumnNumber=0;var scripts=this._scriptsBySourceURL[url]||[];for(var i=0,l=scripts.length;i<l;++i){var script=scripts[i];if(lineNumber===script.lineOffset)
7254 minColumnNumber=minColumnNumber?Math.min(minColumnNumber,script.columnOffset):script.columnOffset;}
7255 columnNumber=Math.max(columnNumber,minColumnNumber);function didSetBreakpoint(error,breakpointId,locations)
7256 {if(callback){var rawLocations=(locations);callback(error?null:breakpointId,rawLocations);}}
7257 DebuggerAgent.setBreakpointByUrl(lineNumber,url,undefined,columnNumber,condition,undefined,didSetBreakpoint.bind(this));WebInspector.userMetrics.ScriptsBreakpointSet.record();},setBreakpointBySourceId:function(rawLocation,condition,callback)
7258 {function didSetBreakpoint(error,breakpointId,actualLocation)
7259 {if(callback){var rawLocation=(actualLocation);callback(error?null:breakpointId,[rawLocation]);}}
7260 DebuggerAgent.setBreakpoint(rawLocation,condition,didSetBreakpoint.bind(this));WebInspector.userMetrics.ScriptsBreakpointSet.record();},removeBreakpoint:function(breakpointId,callback)
7261 {DebuggerAgent.removeBreakpoint(breakpointId,callback);},_breakpointResolved:function(breakpointId,location)
7262 {this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointResolved,{breakpointId:breakpointId,location:location});},_globalObjectCleared:function()
7263 {this._setDebuggerPausedDetails(null);this._reset();this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalObjectCleared);},_reset:function()
7264 {this._scripts={};this._scriptsBySourceURL={};},get scripts()
7265 {return this._scripts;},scriptForId:function(scriptId)
7266 {return this._scripts[scriptId]||null;},scriptsForSourceURL:function(sourceURL)
7267 {if(!sourceURL)
7268 return[];return this._scriptsBySourceURL[sourceURL]||[];},setScriptSource:function(scriptId,newSource,callback)
7269 {this._scripts[scriptId].editSource(newSource,this._didEditScriptSource.bind(this,scriptId,newSource,callback));},_didEditScriptSource:function(scriptId,newSource,callback,error,errorData,callFrames,asyncStackTrace,needsStepIn)
7270 {callback(error,errorData);if(needsStepIn)
7271 this.stepInto();else if(!error&&callFrames&&callFrames.length)
7272 this._pausedScript(callFrames,this._debuggerPausedDetails.reason,this._debuggerPausedDetails.auxData,this._debuggerPausedDetails.breakpointIds,asyncStackTrace);},get callFrames()
7273 {return this._debuggerPausedDetails?this._debuggerPausedDetails.callFrames:null;},debuggerPausedDetails:function()
7274 {return this._debuggerPausedDetails;},_setDebuggerPausedDetails:function(debuggerPausedDetails)
7275 {if(this._debuggerPausedDetails)
7276 this._debuggerPausedDetails.dispose();this._debuggerPausedDetails=debuggerPausedDetails;if(this._debuggerPausedDetails)
7277 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPausedDetails);if(debuggerPausedDetails){this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]);DebuggerAgent.setOverlayMessage(WebInspector.UIString("Paused in debugger"));}else{this.setSelectedCallFrame(null);DebuggerAgent.setOverlayMessage();}},_pausedScript:function(callFrames,reason,auxData,breakpointIds,asyncStackTrace)
7278 {if(this._pendingStepIntoLocation){var requestedLocation=this._pendingStepIntoLocation;delete this._pendingStepIntoLocation;if(callFrames.length>0){var topLocation=callFrames[0].location;if(topLocation.lineNumber==requestedLocation.lineNumber&&topLocation.columnNumber==requestedLocation.columnNumber&&topLocation.scriptId==requestedLocation.scriptId){this.stepInto();return;}}}
7279 this._setDebuggerPausedDetails(new WebInspector.DebuggerPausedDetails(callFrames,reason,auxData,breakpointIds,asyncStackTrace));},_resumedScript:function()
7280 {this._setDebuggerPausedDetails(null);this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerResumed);},_parsedScriptSource:function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL)
7281 {var script=new WebInspector.Script(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL);this._registerScript(script);this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource,script);},_registerScript:function(script)
7282 {this._scripts[script.scriptId]=script;if(script.isAnonymousScript())
7283 return;var scripts=this._scriptsBySourceURL[script.sourceURL];if(!scripts){scripts=[];this._scriptsBySourceURL[script.sourceURL]=scripts;}
7284 scripts.push(script);},createRawLocation:function(script,lineNumber,columnNumber)
7285 {if(script.sourceURL)
7286 return this.createRawLocationByURL(script.sourceURL,lineNumber,columnNumber)
7287 return new WebInspector.DebuggerModel.Location(script.scriptId,lineNumber,columnNumber);},createRawLocationByURL:function(sourceURL,lineNumber,columnNumber)
7288 {var closestScript=null;var scripts=this._scriptsBySourceURL[sourceURL]||[];for(var i=0,l=scripts.length;i<l;++i){var script=scripts[i];if(!closestScript)
7289 closestScript=script;if(script.lineOffset>lineNumber||(script.lineOffset===lineNumber&&script.columnOffset>columnNumber))
7290 continue;if(script.endLine<lineNumber||(script.endLine===lineNumber&&script.endColumn<=columnNumber))
7291 continue;closestScript=script;break;}
7292 return closestScript?new WebInspector.DebuggerModel.Location(closestScript.scriptId,lineNumber,columnNumber):null;},isPaused:function()
7293 {return!!this.debuggerPausedDetails();},setSelectedCallFrame:function(callFrame)
7294 {this._selectedCallFrame=callFrame;if(!this._selectedCallFrame)
7295 return;this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.CallFrameSelected,callFrame);},selectedCallFrame:function()
7296 {return this._selectedCallFrame;},_selectedCallFrameId:function()
7297 {var callFrame=this.selectedCallFrame();return callFrame?callFrame.id:undefined;},evaluateOnSelectedCallFrame:function(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
7298 {function didEvaluate(result,wasThrown)
7299 {if(!result)
7300 callback(null,false);else if(returnByValue)
7301 callback(null,!!wasThrown,wasThrown?null:result);else
7302 callback(WebInspector.RemoteObject.fromPayload(result),!!wasThrown);if(objectGroup==="console")
7303 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame);}
7304 this.selectedCallFrame().evaluate(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,didEvaluate.bind(this));},getSelectedCallFrameVariables:function(callback)
7305 {var result={this:true};var selectedCallFrame=this._selectedCallFrame;if(!selectedCallFrame)
7306 callback(result);var pendingRequests=0;function propertiesCollected(properties)
7307 {for(var i=0;properties&&i<properties.length;++i)
7308 result[properties[i].name]=true;if(--pendingRequests==0)
7309 callback(result);}
7310 for(var i=0;i<selectedCallFrame.scopeChain.length;++i){var scope=selectedCallFrame.scopeChain[i];var object=WebInspector.RemoteObject.fromPayload(scope.object);pendingRequests++;object.getAllProperties(false,propertiesCollected);}},setBreakpointsActive:function(active)
7311 {if(this._breakpointsActive===active)
7312 return;this._breakpointsActive=active;DebuggerAgent.setBreakpointsActive(active);this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointsActiveStateChanged,active);},breakpointsActive:function()
7313 {return this._breakpointsActive;},createLiveLocation:function(rawLocation,updateDelegate)
7314 {var script=this._scripts[rawLocation.scriptId];return script.createLiveLocation(rawLocation,updateDelegate);},rawLocationToUILocation:function(rawLocation)
7315 {var script=this._scripts[rawLocation.scriptId];if(!script)
7316 return null;return script.rawLocationToUILocation(rawLocation.lineNumber,rawLocation.columnNumber);},callStackModified:function(newCallFrames,details,asyncStackTrace)
7317 {if(details&&details["stack_update_needs_step_in"])
7318 this.stepInto();else if(newCallFrames&&newCallFrames.length)
7319 this._pausedScript(newCallFrames,this._debuggerPausedDetails.reason,this._debuggerPausedDetails.auxData,this._debuggerPausedDetails.breakpointIds,asyncStackTrace);},__proto__:WebInspector.Object.prototype}
7320 WebInspector.DebuggerModel.applySkipStackFrameSettings=function()
7321 {if(!WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnabled())
7322 return;var settings=WebInspector.settings;var patternParameter=settings.skipStackFramesSwitch.get()?settings.skipStackFramesPattern.get():undefined;DebuggerAgent.skipStackFrames(patternParameter);}
7323 WebInspector.DebuggerEventTypes={JavaScriptPause:0,JavaScriptBreakpoint:1,NativeBreakpoint:2};WebInspector.DebuggerDispatcher=function(debuggerModel)
7324 {this._debuggerModel=debuggerModel;}
7325 WebInspector.DebuggerDispatcher.prototype={paused:function(callFrames,reason,auxData,breakpointIds,asyncStackTrace)
7326 {this._debuggerModel._pausedScript(callFrames,reason,auxData,breakpointIds||[],asyncStackTrace);},resumed:function()
7327 {this._debuggerModel._resumedScript();},globalObjectCleared:function()
7328 {this._debuggerModel._globalObjectCleared();},scriptParsed:function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL)
7329 {this._debuggerModel._parsedScriptSource(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,!!isContentScript,sourceMapURL,hasSourceURL);},scriptFailedToParse:function(sourceURL,source,startingLine,errorLine,errorMessage)
7330 {},breakpointResolved:function(breakpointId,location)
7331 {this._debuggerModel._breakpointResolved(breakpointId,location);}}
7332 WebInspector.DebuggerModel.CallFrame=function(script,payload,isAsync)
7333 {this._script=script;this._payload=payload;this._locations=[];this._isAsync=isAsync;}
7334 WebInspector.DebuggerModel.CallFrame.fromPayloadArray=function(callFrames,isAsync)
7335 {var result=[];for(var i=0;i<callFrames.length;++i){var callFrame=callFrames[i];var script=WebInspector.debuggerModel.scriptForId(callFrame.location.scriptId);if(script)
7336 result.push(new WebInspector.DebuggerModel.CallFrame(script,callFrame,isAsync));}
7337 return result;}
7338 WebInspector.DebuggerModel.CallFrame.prototype={get script()
7339 {return this._script;},get type()
7340 {return this._payload.type;},get id()
7341 {return this._payload.callFrameId;},get scopeChain()
7342 {return this._payload.scopeChain;},get this()
7343 {return this._payload.this;},get returnValue()
7344 {return this._payload.returnValue;},get functionName()
7345 {return this._payload.functionName;},get location()
7346 {var rawLocation=(this._payload.location);return rawLocation;},isAsync:function()
7347 {return!!this._isAsync;},evaluate:function(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
7348 {function didEvaluateOnCallFrame(error,result,wasThrown)
7349 {if(error){console.error(error);callback(null,false);return;}
7350 callback(result,wasThrown);}
7351 DebuggerAgent.evaluateOnCallFrame(this._payload.callFrameId,code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,didEvaluateOnCallFrame.bind(this));},restart:function(callback)
7352 {function protocolCallback(error,callFrames,details,asyncStackTrace)
7353 {if(!error)
7354 WebInspector.debuggerModel.callStackModified(callFrames,details,asyncStackTrace);if(callback)
7355 callback(error);}
7356 DebuggerAgent.restartFrame(this._payload.callFrameId,protocolCallback);},getStepIntoLocations:function(callback)
7357 {if(this._stepInLocations){callback(this._stepInLocations.slice(0));return;}
7358 function getStepInPositionsCallback(error,stepInPositions)
7359 {if(error)
7360 return;this._stepInLocations=stepInPositions;callback(this._stepInLocations.slice(0));}
7361 DebuggerAgent.getStepInPositions(this.id,getStepInPositionsCallback.bind(this));},createLiveLocation:function(updateDelegate)
7362 {var location=this._script.createLiveLocation(this.location,updateDelegate);this._locations.push(location);return location;},dispose:function()
7363 {for(var i=0;i<this._locations.length;++i)
7364 this._locations[i].dispose();this._locations=[];}}
7365 WebInspector.DebuggerModel.StackTrace=function(callFrames,asyncStackTrace,description)
7366 {this.callFrames=callFrames;this.asyncStackTrace=asyncStackTrace;this.description=description;}
7367 WebInspector.DebuggerModel.StackTrace.fromPayload=function(payload,isAsync)
7368 {if(!payload)
7369 return null;var callFrames=WebInspector.DebuggerModel.CallFrame.fromPayloadArray(payload.callFrames,isAsync);if(!callFrames.length)
7370 return null;var asyncStackTrace=WebInspector.DebuggerModel.StackTrace.fromPayload(payload.asyncStackTrace,true);return new WebInspector.DebuggerModel.StackTrace(callFrames,asyncStackTrace,payload.description);}
7371 WebInspector.DebuggerModel.StackTrace.prototype={dispose:function()
7372 {for(var i=0;i<this.callFrames.length;++i)
7373 this.callFrames[i].dispose();if(this.asyncStackTrace)
7374 this.asyncStackTrace.dispose();}}
7375 WebInspector.DebuggerPausedDetails=function(callFrames,reason,auxData,breakpointIds,asyncStackTrace)
7376 {this.callFrames=WebInspector.DebuggerModel.CallFrame.fromPayloadArray(callFrames);this.reason=reason;this.auxData=auxData;this.breakpointIds=breakpointIds;this.asyncStackTrace=WebInspector.DebuggerModel.StackTrace.fromPayload(asyncStackTrace,true);}
7377 WebInspector.DebuggerPausedDetails.prototype={dispose:function()
7378 {for(var i=0;i<this.callFrames.length;++i)
7379 this.callFrames[i].dispose();if(this.asyncStackTrace)
7380 this.asyncStackTrace.dispose();}}
7381 WebInspector.debuggerModel;WebInspector.SourceMap=function(sourceMappingURL,payload)
7382 {if(!WebInspector.SourceMap.prototype._base64Map){const base64Digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";WebInspector.SourceMap.prototype._base64Map={};for(var i=0;i<base64Digits.length;++i)
7383 WebInspector.SourceMap.prototype._base64Map[base64Digits.charAt(i)]=i;}
7384 this._sourceMappingURL=sourceMappingURL;this._reverseMappingsBySourceURL={};this._mappings=[];this._sources={};this._sourceContentByURL={};this._parseMappingPayload(payload);}
7385 WebInspector.SourceMap._sourceMapRequestHeaderName="X-Source-Map-Request-From";WebInspector.SourceMap._sourceMapRequestHeaderValue="inspector";WebInspector.SourceMap.hasSourceMapRequestHeader=function(request)
7386 {return request&&request.requestHeaderValue(WebInspector.SourceMap._sourceMapRequestHeaderName)===WebInspector.SourceMap._sourceMapRequestHeaderValue;}
7387 WebInspector.SourceMap.load=function(sourceMapURL,compiledURL,callback)
7388 {var headers={};headers[WebInspector.SourceMap._sourceMapRequestHeaderName]=WebInspector.SourceMap._sourceMapRequestHeaderValue;NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,sourceMapURL,headers,contentLoaded.bind(this));function contentLoaded(error,statusCode,headers,content)
7389 {if(error||!content||statusCode>=400){callback(null);return;}
7390 if(content.slice(0,3)===")]}")
7391 content=content.substring(content.indexOf('\n'));try{var payload=(JSON.parse(content));var baseURL=sourceMapURL.startsWith("data:")?compiledURL:sourceMapURL;callback(new WebInspector.SourceMap(baseURL,payload));}catch(e){console.error(e.message);callback(null);}}}
7392 WebInspector.SourceMap.prototype={url:function()
7393 {return this._sourceMappingURL;},sources:function()
7394 {return Object.keys(this._sources);},sourceContent:function(sourceURL)
7395 {return this._sourceContentByURL[sourceURL];},sourceContentProvider:function(sourceURL,contentType)
7396 {var sourceContent=this.sourceContent(sourceURL);if(sourceContent)
7397 return new WebInspector.StaticContentProvider(contentType,sourceContent);return new WebInspector.CompilerSourceMappingContentProvider(sourceURL,contentType);},_parseMappingPayload:function(mappingPayload)
7398 {if(mappingPayload.sections)
7399 this._parseSections(mappingPayload.sections);else
7400 this._parseMap(mappingPayload,0,0);},_parseSections:function(sections)
7401 {for(var i=0;i<sections.length;++i){var section=sections[i];this._parseMap(section.map,section.offset.line,section.offset.column);}},findEntry:function(lineNumber,columnNumber)
7402 {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]))
7403 count=step;else{first=middle;count-=step;}}
7404 var entry=this._mappings[first];if(!first&&entry&&(lineNumber<entry[0]||(lineNumber===entry[0]&&columnNumber<entry[1])))
7405 return null;return entry;},findEntryReversed:function(sourceURL,lineNumber)
7406 {var mappings=this._reverseMappingsBySourceURL[sourceURL];for(;lineNumber<mappings.length;++lineNumber){var mapping=mappings[lineNumber];if(mapping)
7407 return mapping;}
7408 return this._mappings[0];},_parseMap:function(map,lineNumber,columnNumber)
7409 {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 sourceRoot=map.sourceRoot||"";if(sourceRoot&&!sourceRoot.endsWith("/"))
7410 sourceRoot+="/";var href=sourceRoot+originalSourceURL;var url=WebInspector.ParsedURL.completeURL(this._sourceMappingURL,href)||href;originalToCanonicalURLMap[originalSourceURL]=url;sources.push(url);this._sources[url]=true;if(map.sourcesContent&&map.sourcesContent[i])
7411 this._sourceContentByURL[url]=map.sourcesContent[i];}
7412 var stringCharIterator=new WebInspector.SourceMap.StringCharIterator(map.mappings);var sourceURL=sources[sourceIndex];while(true){if(stringCharIterator.peek()===",")
7413 stringCharIterator.next();else{while(stringCharIterator.peek()===";"){lineNumber+=1;columnNumber=0;stringCharIterator.next();}
7414 if(!stringCharIterator.hasNext())
7415 break;}
7416 columnNumber+=this._decodeVLQ(stringCharIterator);if(this._isSeparator(stringCharIterator.peek())){this._mappings.push([lineNumber,columnNumber]);continue;}
7417 var sourceIndexDelta=this._decodeVLQ(stringCharIterator);if(sourceIndexDelta){sourceIndex+=sourceIndexDelta;sourceURL=sources[sourceIndex];}
7418 sourceLineNumber+=this._decodeVLQ(stringCharIterator);sourceColumnNumber+=this._decodeVLQ(stringCharIterator);if(!this._isSeparator(stringCharIterator.peek()))
7419 nameIndex+=this._decodeVLQ(stringCharIterator);this._mappings.push([lineNumber,columnNumber,sourceURL,sourceLineNumber,sourceColumnNumber]);}
7420 for(var i=0;i<this._mappings.length;++i){var mapping=this._mappings[i];var url=mapping[2];if(!url)
7421 continue;if(!this._reverseMappingsBySourceURL[url])
7422 this._reverseMappingsBySourceURL[url]=[];var reverseMappings=this._reverseMappingsBySourceURL[url];var sourceLine=mapping[3];if(!reverseMappings[sourceLine])
7423 reverseMappings[sourceLine]=[mapping[0],mapping[1]];}},_isSeparator:function(char)
7424 {return char===","||char===";";},_decodeVLQ:function(stringCharIterator)
7425 {var result=0;var shift=0;do{var digit=this._base64Map[stringCharIterator.next()];result+=(digit&this._VLQ_BASE_MASK)<<shift;shift+=this._VLQ_BASE_SHIFT;}while(digit&this._VLQ_CONTINUATION_MASK);var negative=result&1;result>>=1;return negative?-result:result;},_VLQ_BASE_SHIFT:5,_VLQ_BASE_MASK:(1<<5)-1,_VLQ_CONTINUATION_MASK:1<<5}
7426 WebInspector.SourceMap.StringCharIterator=function(string)
7427 {this._string=string;this._position=0;}
7428 WebInspector.SourceMap.StringCharIterator.prototype={next:function()
7429 {return this._string.charAt(this._position++);},peek:function()
7430 {return this._string.charAt(this._position);},hasNext:function()
7431 {return this._position<this._string.length;}}
7432 WebInspector.SourceMapping=function()
7433 {}
7434 WebInspector.SourceMapping.prototype={rawLocationToUILocation:function(rawLocation){},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber){}}
7435 WebInspector.ScriptSourceMapping=function()
7436 {}
7437 WebInspector.ScriptSourceMapping.prototype={addScript:function(script){}}
7438 WebInspector.Script=function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL)
7439 {this.scriptId=scriptId;this.sourceURL=sourceURL;this.lineOffset=startLine;this.columnOffset=startColumn;this.endLine=endLine;this.endColumn=endColumn;this.isContentScript=isContentScript;this.sourceMapURL=sourceMapURL;this.hasSourceURL=hasSourceURL;this._locations=new Set();this._sourceMappings=[];}
7440 WebInspector.Script.Events={ScriptEdited:"ScriptEdited",}
7441 WebInspector.Script.snippetSourceURLPrefix="snippets:///";WebInspector.Script._trimSourceURLComment=function(source)
7442 {var sourceURLRegex=/\n[\040\t]*\/\/[@#]\ssourceURL=\s*(\S*?)\s*$/mg;return source.replace(sourceURLRegex,"");},WebInspector.Script.prototype={contentURL:function()
7443 {return this.sourceURL;},contentType:function()
7444 {return WebInspector.resourceTypes.Script;},requestContent:function(callback)
7445 {if(this._source){callback(this._source);return;}
7446 function didGetScriptSource(error,source)
7447 {this._source=WebInspector.Script._trimSourceURLComment(error?"":source);callback(this._source);}
7448 if(this.scriptId){DebuggerAgent.getScriptSource(this.scriptId,didGetScriptSource.bind(this));}else
7449 callback("");},searchInContent:function(query,caseSensitive,isRegex,callback)
7450 {function innerCallback(error,searchMatches)
7451 {if(error)
7452 console.error(error);var result=[];for(var i=0;i<searchMatches.length;++i){var searchMatch=new WebInspector.ContentProvider.SearchMatch(searchMatches[i].lineNumber,searchMatches[i].lineContent);result.push(searchMatch);}
7453 callback(result||[]);}
7454 if(this.scriptId){DebuggerAgent.searchInContent(this.scriptId,query,caseSensitive,isRegex,innerCallback.bind(this));}else
7455 callback([]);},_appendSourceURLCommentIfNeeded:function(source)
7456 {if(!this.hasSourceURL)
7457 return source;return source+"\n //# sourceURL="+this.sourceURL;},editSource:function(newSource,callback)
7458 {function didEditScriptSource(error,errorData,callFrames,debugData,asyncStackTrace)
7459 {if(!error)
7460 this._source=newSource;var needsStepIn=!!debugData&&debugData["stack_update_needs_step_in"]===true;callback(error,errorData,callFrames,asyncStackTrace,needsStepIn);if(!error)
7461 this.dispatchEventToListeners(WebInspector.Script.Events.ScriptEdited,newSource);}
7462 newSource=WebInspector.Script._trimSourceURLComment(newSource);newSource=this._appendSourceURLCommentIfNeeded(newSource);if(this.scriptId)
7463 DebuggerAgent.setScriptSource(this.scriptId,newSource,undefined,didEditScriptSource.bind(this));else
7464 callback("Script failed to parse");},isInlineScript:function()
7465 {var startsAtZero=!this.lineOffset&&!this.columnOffset;return!!this.sourceURL&&!startsAtZero;},isAnonymousScript:function()
7466 {return!this.sourceURL;},isSnippet:function()
7467 {return!!this.sourceURL&&this.sourceURL.startsWith(WebInspector.Script.snippetSourceURLPrefix);},rawLocationToUILocation:function(lineNumber,columnNumber)
7468 {var uiLocation;var rawLocation=new WebInspector.DebuggerModel.Location(this.scriptId,lineNumber,columnNumber||0);for(var i=this._sourceMappings.length-1;!uiLocation&&i>=0;--i)
7469 uiLocation=this._sourceMappings[i].rawLocationToUILocation(rawLocation);console.assert(uiLocation,"Script raw location can not be mapped to any ui location.");return uiLocation.uiSourceCode.overrideLocation(uiLocation);},pushSourceMapping:function(sourceMapping)
7470 {this._sourceMappings.push(sourceMapping);this.updateLocations();},updateLocations:function()
7471 {var items=this._locations.items();for(var i=0;i<items.length;++i)
7472 items[i].update();},createLiveLocation:function(rawLocation,updateDelegate)
7473 {console.assert(rawLocation.scriptId===this.scriptId);var location=new WebInspector.Script.Location(this,rawLocation,updateDelegate);this._locations.add(location);location.update();return location;},__proto__:WebInspector.Object.prototype}
7474 WebInspector.Script.Location=function(script,rawLocation,updateDelegate)
7475 {WebInspector.LiveLocation.call(this,rawLocation,updateDelegate);this._script=script;}
7476 WebInspector.Script.Location.prototype={uiLocation:function()
7477 {var debuggerModelLocation=(this.rawLocation());return this._script.rawLocationToUILocation(debuggerModelLocation.lineNumber,debuggerModelLocation.columnNumber);},dispose:function()
7478 {WebInspector.LiveLocation.prototype.dispose.call(this);this._script._locations.remove(this);},__proto__:WebInspector.LiveLocation.prototype}
7479 WebInspector.LinkifierFormatter=function()
7480 {}
7481 WebInspector.LinkifierFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation){}}
7482 WebInspector.Linkifier=function(formatter)
7483 {this._formatter=formatter||new WebInspector.Linkifier.DefaultFormatter(WebInspector.Linkifier.MaxLengthForDisplayedURLs);this._liveLocations=[];}
7484 WebInspector.Linkifier.prototype={linkifyLocation:function(sourceURL,lineNumber,columnNumber,classes)
7485 {var rawLocation=WebInspector.debuggerModel.createRawLocationByURL(sourceURL,lineNumber,columnNumber||0);if(!rawLocation)
7486 return WebInspector.linkifyResourceAsNode(sourceURL,lineNumber,classes);return this.linkifyRawLocation(rawLocation,classes);},linkifyRawLocation:function(rawLocation,classes)
7487 {var script=WebInspector.debuggerModel.scriptForId(rawLocation.scriptId);if(!script)
7488 return null;var anchor=WebInspector.linkifyURLAsNode("","",classes,false);var liveLocation=script.createLiveLocation(rawLocation,this._updateAnchor.bind(this,anchor));this._liveLocations.push(liveLocation);return anchor;},linkifyCSSLocation:function(styleSheetId,rawLocation,classes)
7489 {var anchor=WebInspector.linkifyURLAsNode("","",classes,false);var liveLocation=WebInspector.cssModel.createLiveLocation(styleSheetId,rawLocation,this._updateAnchor.bind(this,anchor));if(!liveLocation)
7490 return null;this._liveLocations.push(liveLocation);return anchor;},reset:function()
7491 {for(var i=0;i<this._liveLocations.length;++i)
7492 this._liveLocations[i].dispose();this._liveLocations=[];},_updateAnchor:function(anchor,uiLocation)
7493 {anchor.preferredPanel="sources";anchor.href=sanitizeHref(uiLocation.uiSourceCode.originURL());anchor.uiSourceCode=uiLocation.uiSourceCode;anchor.lineNumber=uiLocation.lineNumber;anchor.columnNumber=uiLocation.columnNumber;this._formatter.formatLiveAnchor(anchor,uiLocation);}}
7494 WebInspector.Linkifier.DefaultFormatter=function(maxLength)
7495 {this._maxLength=maxLength;}
7496 WebInspector.Linkifier.DefaultFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation)
7497 {var text=uiLocation.linkText();if(this._maxLength)
7498 text=text.trimMiddle(this._maxLength);anchor.textContent=text;var titleText=uiLocation.uiSourceCode.originURL();if(typeof uiLocation.lineNumber==="number")
7499 titleText+=":"+(uiLocation.lineNumber+1);anchor.title=titleText;}}
7500 WebInspector.Linkifier.DefaultCSSFormatter=function()
7501 {WebInspector.Linkifier.DefaultFormatter.call(this,WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs);}
7502 WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs=30;WebInspector.Linkifier.DefaultCSSFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation)
7503 {WebInspector.Linkifier.DefaultFormatter.prototype.formatLiveAnchor.call(this,anchor,uiLocation);anchor.classList.add("webkit-html-resource-link");anchor.setAttribute("data-uncopyable",anchor.textContent);anchor.textContent="";},__proto__:WebInspector.Linkifier.DefaultFormatter.prototype}
7504 WebInspector.Linkifier.MaxLengthForDisplayedURLs=150;WebInspector.DebuggerScriptMapping=function(workspace,networkWorkspaceProvider)
7505 {this._defaultMapping=new WebInspector.DefaultScriptMapping(workspace);this._resourceMapping=new WebInspector.ResourceScriptMapping(workspace);this._compilerMapping=new WebInspector.CompilerScriptMapping(workspace,networkWorkspaceProvider);this._snippetMapping=WebInspector.scriptSnippetModel.scriptMapping;WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource,this._parsedScriptSource,this);}
7506 WebInspector.DebuggerScriptMapping.prototype={_parsedScriptSource:function(event)
7507 {var script=(event.data);this._defaultMapping.addScript(script);if(script.isSnippet()){this._snippetMapping.addScript(script);return;}
7508 this._resourceMapping.addScript(script);if(WebInspector.settings.jsSourceMapsEnabled.get())
7509 this._compilerMapping.addScript(script);}}
7510 WebInspector.PresentationConsoleMessageHelper=function(workspace)
7511 {this._pendingConsoleMessages={};this._presentationConsoleMessages=[];this._workspace=workspace;WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._consoleMessageAdded,this);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated,this._consoleMessageAdded,this);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource,this._parsedScriptSource,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
7512 WebInspector.PresentationConsoleMessageHelper.prototype={_consoleMessageAdded:function(event)
7513 {var message=(event.data);if(!message.url||!message.isErrorOrWarning())
7514 return;var rawLocation=message.location();if(rawLocation)
7515 this._addConsoleMessageToScript(message,rawLocation);else
7516 this._addPendingConsoleMessage(message);},_addConsoleMessageToScript:function(message,rawLocation)
7517 {this._presentationConsoleMessages.push(new WebInspector.PresentationConsoleMessage(message,rawLocation));},_addPendingConsoleMessage:function(message)
7518 {if(!message.url)
7519 return;if(!this._pendingConsoleMessages[message.url])
7520 this._pendingConsoleMessages[message.url]=[];this._pendingConsoleMessages[message.url].push(message);},_parsedScriptSource:function(event)
7521 {var script=(event.data);var messages=this._pendingConsoleMessages[script.sourceURL];if(!messages)
7522 return;var pendingMessages=[];for(var i=0;i<messages.length;i++){var message=messages[i];var rawLocation=(message.location());if(script.scriptId===rawLocation.scriptId)
7523 this._addConsoleMessageToScript(message,rawLocation);else
7524 pendingMessages.push(message);}
7525 if(pendingMessages.length)
7526 this._pendingConsoleMessages[script.sourceURL]=pendingMessages;else
7527 delete this._pendingConsoleMessages[script.sourceURL];},_consoleCleared:function()
7528 {this._pendingConsoleMessages={};for(var i=0;i<this._presentationConsoleMessages.length;++i)
7529 this._presentationConsoleMessages[i].dispose();this._presentationConsoleMessages=[];var uiSourceCodes=this._workspace.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
7530 uiSourceCodes[i].consoleMessagesCleared();},_debuggerReset:function()
7531 {this._pendingConsoleMessages={};this._presentationConsoleMessages=[];}}
7532 WebInspector.PresentationConsoleMessage=function(message,rawLocation)
7533 {this.originalMessage=message;this._liveLocation=WebInspector.debuggerModel.createLiveLocation(rawLocation,this._updateLocation.bind(this));}
7534 WebInspector.PresentationConsoleMessage.prototype={_updateLocation:function(uiLocation)
7535 {if(this._uiLocation)
7536 this._uiLocation.uiSourceCode.consoleMessageRemoved(this);this._uiLocation=uiLocation;this._uiLocation.uiSourceCode.consoleMessageAdded(this);},get lineNumber()
7537 {return this._uiLocation.lineNumber;},dispose:function()
7538 {this._liveLocation.dispose();}}
7539 WebInspector.FileSystemProjectDelegate=function(isolatedFileSystem,workspace)
7540 {this._fileSystem=isolatedFileSystem;this._normalizedFileSystemPath=this._fileSystem.path();if(WebInspector.isWin())
7541 this._normalizedFileSystemPath=this._normalizedFileSystemPath.replace(/\\/g,"/");this._fileSystemURL="file://"+this._normalizedFileSystemPath+"/";this._workspace=workspace;this._searchCallbacks={};this._indexingCallbacks={};this._indexingProgresses={};}
7542 WebInspector.FileSystemProjectDelegate._scriptExtensions=["js","java","coffee","ts","dart"].keySet();WebInspector.FileSystemProjectDelegate._styleSheetExtensions=["css","scss","sass","less"].keySet();WebInspector.FileSystemProjectDelegate._documentExtensions=["htm","html","asp","aspx","phtml","jsp"].keySet();WebInspector.FileSystemProjectDelegate.projectId=function(fileSystemPath)
7543 {return"filesystem:"+fileSystemPath;}
7544 WebInspector.FileSystemProjectDelegate._lastRequestId=0;WebInspector.FileSystemProjectDelegate.prototype={id:function()
7545 {return WebInspector.FileSystemProjectDelegate.projectId(this._fileSystem.path());},type:function()
7546 {return WebInspector.projectTypes.FileSystem;},fileSystemPath:function()
7547 {return this._fileSystem.path();},displayName:function()
7548 {return this._normalizedFileSystemPath.substr(this._normalizedFileSystemPath.lastIndexOf("/")+1);},_filePathForPath:function(path)
7549 {return"/"+path;},requestFileContent:function(path,callback)
7550 {var filePath=this._filePathForPath(path);this._fileSystem.requestFileContent(filePath,callback);},requestMetadata:function(path,callback)
7551 {var filePath=this._filePathForPath(path);this._fileSystem.requestMetadata(filePath,callback);},canSetFileContent:function()
7552 {return true;},setFileContent:function(path,newContent,callback)
7553 {var filePath=this._filePathForPath(path);this._fileSystem.setFileContent(filePath,newContent,callback.bind(this,""));},canRename:function()
7554 {return true;},rename:function(path,newName,callback)
7555 {var filePath=this._filePathForPath(path);this._fileSystem.renameFile(filePath,newName,innerCallback.bind(this));function innerCallback(success,newName)
7556 {if(!success){callback(false,newName);return;}
7557 var validNewName=(newName);console.assert(validNewName);var slash=filePath.lastIndexOf("/");var parentPath=filePath.substring(0,slash);filePath=parentPath+"/"+validNewName;var newURL=this._workspace.urlForPath(this._fileSystem.path(),filePath);var extension=this._extensionForPath(validNewName);var newOriginURL=this._fileSystemURL+filePath
7558 var newContentType=this._contentTypeForExtension(extension);callback(true,validNewName,newURL,newOriginURL,newContentType);}},searchInFileContent:function(path,query,caseSensitive,isRegex,callback)
7559 {var filePath=this._filePathForPath(path);this._fileSystem.requestFileContent(filePath,contentCallback.bind(this));function contentCallback(content)
7560 {var result=[];if(content!==null)
7561 result=WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex);callback(result);}},findFilesMatchingSearchRequest:function(queries,fileQueries,caseSensitive,isRegex,progress,callback)
7562 {var result=[];var queriesToRun=queries.slice();if(!queriesToRun.length)
7563 queriesToRun.push("");progress.setTotalWork(queriesToRun.length);searchNextQuery.call(this);function searchNextQuery()
7564 {if(!queriesToRun.length){matchFileQueries.call(this,result);return;}
7565 var query=queriesToRun.shift();this._searchInPath(isRegex?"":query,progress,innerCallback.bind(this));}
7566 function innerCallback(files)
7567 {files=files.sort();progress.worked(1);if(!result)
7568 result=files;else
7569 result=result.intersectOrdered(files,String.naturalOrderComparator);searchNextQuery.call(this);}
7570 function matchFileQueries(files)
7571 {var fileRegexes=[];for(var i=0;i<fileQueries.length;++i)
7572 fileRegexes.push(new RegExp(fileQueries[i],caseSensitive?"":"i"));function filterOutNonMatchingFiles(file)
7573 {for(var i=0;i<fileRegexes.length;++i){if(!file.match(fileRegexes[i]))
7574 return false;}
7575 return true;}
7576 files=files.filter(filterOutNonMatchingFiles);progress.done();callback(files);}},_searchInPath:function(query,progress,callback)
7577 {var requestId=++WebInspector.FileSystemProjectDelegate._lastRequestId;this._searchCallbacks[requestId]=innerCallback.bind(this);InspectorFrontendHost.searchInPath(requestId,this._fileSystem.path(),query);function innerCallback(files)
7578 {function trimAndNormalizeFileSystemPath(fullPath)
7579 {var trimmedPath=fullPath.substr(this._fileSystem.path().length+1);if(WebInspector.isWin())
7580 trimmedPath=trimmedPath.replace(/\\/g,"/");return trimmedPath;}
7581 files=files.map(trimAndNormalizeFileSystemPath.bind(this));progress.worked(1);callback(files);}},searchCompleted:function(requestId,files)
7582 {if(!this._searchCallbacks[requestId])
7583 return;var callback=this._searchCallbacks[requestId];delete this._searchCallbacks[requestId];callback(files);},indexContent:function(progress,callback)
7584 {var requestId=++WebInspector.FileSystemProjectDelegate._lastRequestId;this._indexingCallbacks[requestId]=callback;this._indexingProgresses[requestId]=progress;progress.setTotalWork(1);progress.addEventListener(WebInspector.Progress.Events.Canceled,this._indexingCanceled.bind(this,requestId));InspectorFrontendHost.indexPath(requestId,this._fileSystem.path());},_indexingCanceled:function(requestId)
7585 {if(!this._indexingProgresses[requestId])
7586 return;InspectorFrontendHost.stopIndexing(requestId);delete this._indexingProgresses[requestId];delete this._indexingCallbacks[requestId];},indexingTotalWorkCalculated:function(requestId,totalWork)
7587 {if(!this._indexingProgresses[requestId])
7588 return;var progress=this._indexingProgresses[requestId];progress.setTotalWork(totalWork);},indexingWorked:function(requestId,worked)
7589 {if(!this._indexingProgresses[requestId])
7590 return;var progress=this._indexingProgresses[requestId];progress.worked(worked);},indexingDone:function(requestId)
7591 {if(!this._indexingProgresses[requestId])
7592 return;var progress=this._indexingProgresses[requestId];var callback=this._indexingCallbacks[requestId];delete this._indexingProgresses[requestId];delete this._indexingCallbacks[requestId];progress.done();callback.call();},_extensionForPath:function(path)
7593 {var extensionIndex=path.lastIndexOf(".");if(extensionIndex===-1)
7594 return"";return path.substring(extensionIndex+1).toLowerCase();},_contentTypeForExtension:function(extension)
7595 {if(WebInspector.FileSystemProjectDelegate._scriptExtensions[extension])
7596 return WebInspector.resourceTypes.Script;if(WebInspector.FileSystemProjectDelegate._styleSheetExtensions[extension])
7597 return WebInspector.resourceTypes.Stylesheet;if(WebInspector.FileSystemProjectDelegate._documentExtensions[extension])
7598 return WebInspector.resourceTypes.Document;return WebInspector.resourceTypes.Other;},populate:function()
7599 {this._fileSystem.requestFilesRecursive("",this._addFile.bind(this));},refresh:function(path)
7600 {this._fileSystem.requestFilesRecursive(path,this._addFile.bind(this));},excludeFolder:function(path)
7601 {WebInspector.isolatedFileSystemManager.mapping().addExcludedFolder(this._fileSystem.path(),path);},createFile:function(path,name,content,callback)
7602 {this._fileSystem.createFile(path,name,innerCallback.bind(this));var createFilePath;function innerCallback(filePath)
7603 {if(!filePath){callback(null);return;}
7604 createFilePath=filePath;if(!content){contentSet.call(this);return;}
7605 this._fileSystem.setFileContent(filePath,content,contentSet.bind(this));}
7606 function contentSet()
7607 {this._addFile(createFilePath);callback(createFilePath);}},deleteFile:function(path)
7608 {this._fileSystem.deleteFile(path);this._removeFile(path);},remove:function()
7609 {WebInspector.isolatedFileSystemManager.removeFileSystem(this._fileSystem.path());},_addFile:function(filePath)
7610 {if(!filePath)
7611 console.assert(false);var slash=filePath.lastIndexOf("/");var parentPath=filePath.substring(0,slash);var name=filePath.substring(slash+1);var url=this._workspace.urlForPath(this._fileSystem.path(),filePath);var extension=this._extensionForPath(name);var contentType=this._contentTypeForExtension(extension);var fileDescriptor=new WebInspector.FileDescriptor(parentPath,name,this._fileSystemURL+filePath,url,contentType,true);this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded,fileDescriptor);},_removeFile:function(path)
7612 {this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved,path);},reset:function()
7613 {this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.Reset,null);},__proto__:WebInspector.Object.prototype}
7614 WebInspector.fileSystemProjectDelegate;WebInspector.FileSystemWorkspaceProvider=function(isolatedFileSystemManager,workspace)
7615 {this._isolatedFileSystemManager=isolatedFileSystemManager;this._workspace=workspace;this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded,this._fileSystemAdded,this);this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved,this._fileSystemRemoved,this);this._projectDelegates={};}
7616 WebInspector.FileSystemWorkspaceProvider.prototype={_fileSystemAdded:function(event)
7617 {var fileSystem=(event.data);var projectId=WebInspector.FileSystemProjectDelegate.projectId(fileSystem.path());var projectDelegate=new WebInspector.FileSystemProjectDelegate(fileSystem,this._workspace)
7618 this._projectDelegates[projectDelegate.id()]=projectDelegate;console.assert(!this._workspace.project(projectDelegate.id()));this._workspace.addProject(projectDelegate);projectDelegate.populate();},_fileSystemRemoved:function(event)
7619 {var fileSystem=(event.data);var projectId=WebInspector.FileSystemProjectDelegate.projectId(fileSystem.path());this._workspace.removeProject(projectId);delete this._projectDelegates[projectId];},fileSystemPath:function(uiSourceCode)
7620 {var projectDelegate=this._projectDelegates[uiSourceCode.project().id()];return projectDelegate.fileSystemPath();},delegate:function(fileSystemPath)
7621 {var projectId=WebInspector.FileSystemProjectDelegate.projectId(fileSystemPath);return this._projectDelegates[projectId];}}
7622 WebInspector.fileSystemWorkspaceProvider;WebInspector.FileSystemMapping=function()
7623 {WebInspector.Object.call(this);this._fileSystemMappingSetting=WebInspector.settings.createSetting("fileSystemMapping",{});this._excludedFoldersSetting=WebInspector.settings.createSetting("workspaceExcludedFolders",{});var defaultCommonExcludedFolders=["/\\.git/","/\\.sass-cache/","/\\.hg/","/\\.idea/","/\\.svn/","/\\.cache/","/\\.project/"];var defaultWinExcludedFolders=["/Thumbs.db$","/ehthumbs.db$","/Desktop.ini$","/\\$RECYCLE.BIN/"];var defaultMacExcludedFolders=["/\\.DS_Store$","/\\.Trashes$","/\\.Spotlight-V100$","/\\.AppleDouble$","/\\.LSOverride$","/Icon$","/\\._.*$"];var defaultLinuxExcludedFolders=["/.*~$"];var defaultExcludedFolders=defaultCommonExcludedFolders;if(WebInspector.isWin())
7624 defaultExcludedFolders=defaultExcludedFolders.concat(defaultWinExcludedFolders);else if(WebInspector.isMac())
7625 defaultExcludedFolders=defaultExcludedFolders.concat(defaultMacExcludedFolders);else
7626 defaultExcludedFolders=defaultExcludedFolders.concat(defaultLinuxExcludedFolders);var defaultExcludedFoldersPattern=defaultExcludedFolders.join("|");WebInspector.settings.workspaceFolderExcludePattern=WebInspector.settings.createSetting("workspaceFolderExcludePattern",defaultExcludedFoldersPattern);this._fileSystemMappings={};this._excludedFolders={};this._loadFromSettings();}
7627 WebInspector.FileSystemMapping.Events={FileMappingAdded:"FileMappingAdded",FileMappingRemoved:"FileMappingRemoved",ExcludedFolderAdded:"ExcludedFolderAdded",ExcludedFolderRemoved:"ExcludedFolderRemoved"}
7628 WebInspector.FileSystemMapping.prototype={_loadFromSettings:function()
7629 {var savedMapping=this._fileSystemMappingSetting.get();this._fileSystemMappings={};for(var fileSystemPath in savedMapping){var savedFileSystemMappings=savedMapping[fileSystemPath];this._fileSystemMappings[fileSystemPath]=[];var fileSystemMappings=this._fileSystemMappings[fileSystemPath];for(var i=0;i<savedFileSystemMappings.length;++i){var savedEntry=savedFileSystemMappings[i];var entry=new WebInspector.FileSystemMapping.Entry(savedEntry.fileSystemPath,savedEntry.urlPrefix,savedEntry.pathPrefix);fileSystemMappings.push(entry);}}
7630 var savedExcludedFolders=this._excludedFoldersSetting.get();this._excludedFolders={};for(var fileSystemPath in savedExcludedFolders){var savedExcludedFoldersForPath=savedExcludedFolders[fileSystemPath];this._excludedFolders[fileSystemPath]=[];var excludedFolders=this._excludedFolders[fileSystemPath];for(var i=0;i<savedExcludedFoldersForPath.length;++i){var savedEntry=savedExcludedFoldersForPath[i];var entry=new WebInspector.FileSystemMapping.ExcludedFolderEntry(savedEntry.fileSystemPath,savedEntry.path);excludedFolders.push(entry);}}
7631 var workspaceFolderExcludePattern=WebInspector.settings.workspaceFolderExcludePattern.get()
7632 try{var flags=WebInspector.isWin()?"i":"";this._workspaceFolderExcludeRegex=workspaceFolderExcludePattern?new RegExp(workspaceFolderExcludePattern,flags):null;}catch(e){}
7633 this._rebuildIndexes();},_saveToSettings:function()
7634 {var savedMapping=this._fileSystemMappings;this._fileSystemMappingSetting.set(savedMapping);var savedExcludedFolders=this._excludedFolders;this._excludedFoldersSetting.set(savedExcludedFolders);this._rebuildIndexes();},_rebuildIndexes:function()
7635 {this._mappingForURLPrefix={};this._urlPrefixes=[];for(var fileSystemPath in this._fileSystemMappings){var fileSystemMapping=this._fileSystemMappings[fileSystemPath];for(var i=0;i<fileSystemMapping.length;++i){var entry=fileSystemMapping[i];this._mappingForURLPrefix[entry.urlPrefix]=entry;this._urlPrefixes.push(entry.urlPrefix);}}
7636 this._urlPrefixes.sort();},addFileSystem:function(fileSystemPath)
7637 {if(this._fileSystemMappings[fileSystemPath])
7638 return;this._fileSystemMappings[fileSystemPath]=[];this._saveToSettings();},removeFileSystem:function(fileSystemPath)
7639 {if(!this._fileSystemMappings[fileSystemPath])
7640 return;delete this._fileSystemMappings[fileSystemPath];delete this._excludedFolders[fileSystemPath];this._saveToSettings();},addFileMapping:function(fileSystemPath,urlPrefix,pathPrefix)
7641 {var entry=new WebInspector.FileSystemMapping.Entry(fileSystemPath,urlPrefix,pathPrefix);this._fileSystemMappings[fileSystemPath].push(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.FileMappingAdded,entry);},removeFileMapping:function(fileSystemPath,urlPrefix,pathPrefix)
7642 {var entry=this._mappingEntryForPathPrefix(fileSystemPath,pathPrefix);if(!entry)
7643 return;this._fileSystemMappings[fileSystemPath].remove(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.FileMappingRemoved,entry);},addExcludedFolder:function(fileSystemPath,excludedFolderPath)
7644 {if(!this._excludedFolders[fileSystemPath])
7645 this._excludedFolders[fileSystemPath]=[];var entry=new WebInspector.FileSystemMapping.ExcludedFolderEntry(fileSystemPath,excludedFolderPath);this._excludedFolders[fileSystemPath].push(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.ExcludedFolderAdded,entry);},removeExcludedFolder:function(fileSystemPath,path)
7646 {var entry=this._excludedFolderEntryForPath(fileSystemPath,path);if(!entry)
7647 return;this._excludedFolders[fileSystemPath].remove(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.ExcludedFolderRemoved,entry);},fileSystemPaths:function()
7648 {return Object.keys(this._fileSystemMappings);},_mappingEntryForURL:function(url)
7649 {for(var i=this._urlPrefixes.length-1;i>=0;--i){var urlPrefix=this._urlPrefixes[i];if(url.startsWith(urlPrefix))
7650 return this._mappingForURLPrefix[urlPrefix];}
7651 return null;},_excludedFolderEntryForPath:function(fileSystemPath,path)
7652 {var entries=this._excludedFolders[fileSystemPath];if(!entries)
7653 return null;for(var i=0;i<entries.length;++i){if(entries[i].path===path)
7654 return entries[i];}
7655 return null;},_mappingEntryForPath:function(fileSystemPath,filePath)
7656 {var entries=this._fileSystemMappings[fileSystemPath];if(!entries)
7657 return null;var entry=null;for(var i=0;i<entries.length;++i){var pathPrefix=entries[i].pathPrefix;if(entry&&entry.pathPrefix.length>pathPrefix.length)
7658 continue;if(filePath.startsWith(pathPrefix.substr(1)))
7659 entry=entries[i];}
7660 return entry;},_mappingEntryForPathPrefix:function(fileSystemPath,pathPrefix)
7661 {var entries=this._fileSystemMappings[fileSystemPath];for(var i=0;i<entries.length;++i){if(pathPrefix===entries[i].pathPrefix)
7662 return entries[i];}
7663 return null;},isFileExcluded:function(fileSystemPath,folderPath)
7664 {var excludedFolders=this._excludedFolders[fileSystemPath]||[];for(var i=0;i<excludedFolders.length;++i){var entry=excludedFolders[i];if(entry.path===folderPath)
7665 return true;}
7666 return this._workspaceFolderExcludeRegex&&this._workspaceFolderExcludeRegex.test(folderPath);},excludedFolders:function(fileSystemPath)
7667 {var excludedFolders=this._excludedFolders[fileSystemPath];return excludedFolders?excludedFolders.slice():[];},mappingEntries:function(fileSystemPath)
7668 {return this._fileSystemMappings[fileSystemPath].slice();},hasMappingForURL:function(url)
7669 {return!!this._mappingEntryForURL(url);},fileForURL:function(url)
7670 {var entry=this._mappingEntryForURL(url);if(!entry)
7671 return null;var file={};file.fileSystemPath=entry.fileSystemPath;file.filePath=entry.pathPrefix.substr(1)+url.substr(entry.urlPrefix.length);return file;},urlForPath:function(fileSystemPath,filePath)
7672 {var entry=this._mappingEntryForPath(fileSystemPath,filePath);if(!entry)
7673 return"";return entry.urlPrefix+filePath.substring(entry.pathPrefix.length-1);},removeMappingForURL:function(url)
7674 {var entry=this._mappingEntryForURL(url);if(!entry)
7675 return;this._fileSystemMappings[entry.fileSystemPath].remove(entry);this._saveToSettings();},addMappingForResource:function(url,fileSystemPath,filePath)
7676 {var commonPathSuffixLength=0;var normalizedFilePath="/"+filePath;for(var i=0;i<normalizedFilePath.length;++i){var filePathCharacter=normalizedFilePath[normalizedFilePath.length-1-i];var urlCharacter=url[url.length-1-i];if(filePathCharacter!==urlCharacter)
7677 break;if(filePathCharacter==="/")
7678 commonPathSuffixLength=i;}
7679 var pathPrefix=normalizedFilePath.substr(0,normalizedFilePath.length-commonPathSuffixLength);var urlPrefix=url.substr(0,url.length-commonPathSuffixLength);this.addFileMapping(fileSystemPath,urlPrefix,pathPrefix);},__proto__:WebInspector.Object.prototype}
7680 WebInspector.FileSystemMapping.Entry=function(fileSystemPath,urlPrefix,pathPrefix)
7681 {this.fileSystemPath=fileSystemPath;this.urlPrefix=urlPrefix;this.pathPrefix=pathPrefix;}
7682 WebInspector.FileSystemMapping.ExcludedFolderEntry=function(fileSystemPath,path)
7683 {this.fileSystemPath=fileSystemPath;this.path=path;}
7684 WebInspector.IsolatedFileSystem=function(manager,path,name,rootURL)
7685 {this._manager=manager;this._path=path;this._name=name;this._rootURL=rootURL;}
7686 WebInspector.IsolatedFileSystem.errorMessage=function(error)
7687 {var msg;switch(error.code){case FileError.QUOTA_EXCEEDED_ERR:msg="QUOTA_EXCEEDED_ERR";break;case FileError.NOT_FOUND_ERR:msg="NOT_FOUND_ERR";break;case FileError.SECURITY_ERR:msg="SECURITY_ERR";break;case FileError.INVALID_MODIFICATION_ERR:msg="INVALID_MODIFICATION_ERR";break;case FileError.INVALID_STATE_ERR:msg="INVALID_STATE_ERR";break;default:msg=WebInspector.UIString("Unknown Error");break;};return WebInspector.UIString("File system error: %s",msg);}
7688 WebInspector.IsolatedFileSystem.prototype={path:function()
7689 {return this._path;},name:function()
7690 {return this._name;},rootURL:function()
7691 {return this._rootURL;},_requestFileSystem:function(callback)
7692 {this._manager.requestDOMFileSystem(this._path,callback);},requestFilesRecursive:function(path,callback)
7693 {this._requestFileSystem(fileSystemLoaded.bind(this));var domFileSystem;function fileSystemLoaded(fs)
7694 {domFileSystem=(fs);console.assert(domFileSystem);this._requestEntries(domFileSystem,path,innerCallback.bind(this));}
7695 function innerCallback(entries)
7696 {for(var i=0;i<entries.length;++i){var entry=entries[i];if(!entry.isDirectory){if(this._manager.mapping().isFileExcluded(this._path,entry.fullPath))
7697 continue;callback(entry.fullPath.substr(1));}
7698 else{if(this._manager.mapping().isFileExcluded(this._path,entry.fullPath+"/"))
7699 continue;this._requestEntries(domFileSystem,entry.fullPath,innerCallback.bind(this));}}}},createFile:function(path,name,callback)
7700 {this._requestFileSystem(fileSystemLoaded.bind(this));var newFileIndex=1;if(!name)
7701 name="NewFile";var nameCandidate;function fileSystemLoaded(fs)
7702 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getDirectory(path,null,dirEntryLoaded.bind(this),errorHandler.bind(this));}
7703 function dirEntryLoaded(dirEntry)
7704 {var nameCandidate=name;if(newFileIndex>1)
7705 nameCandidate+=newFileIndex;++newFileIndex;dirEntry.getFile(nameCandidate,{create:true,exclusive:true},fileCreated,fileCreationError.bind(this));function fileCreated(entry)
7706 {callback(entry.fullPath.substr(1));}
7707 function fileCreationError(error)
7708 {if(error.code===FileError.INVALID_MODIFICATION_ERR){dirEntryLoaded.call(this,dirEntry);return;}
7709 var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when testing if file exists '"+(this._path+"/"+path+"/"+nameCandidate)+"'");callback(null);}}
7710 function errorHandler(error)
7711 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);var filePath=this._path+"/"+path;if(nameCandidate)
7712 filePath+="/"+nameCandidate;console.error(errorMessage+" when getting content for file '"+(filePath)+"'");callback(null);}},deleteFile:function(path)
7713 {this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
7714 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded.bind(this),errorHandler.bind(this));}
7715 function fileEntryLoaded(fileEntry)
7716 {fileEntry.remove(fileEntryRemoved.bind(this),errorHandler.bind(this));}
7717 function fileEntryRemoved()
7718 {}
7719 function errorHandler(error)
7720 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when deleting file '"+(this._path+"/"+path)+"'");}},requestMetadata:function(path,callback)
7721 {this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
7722 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded,errorHandler);}
7723 function fileEntryLoaded(entry)
7724 {entry.getMetadata(successHandler,errorHandler);}
7725 function successHandler(metadata)
7726 {callback(metadata.modificationTime,metadata.size);}
7727 function errorHandler(error)
7728 {callback(null,null);}},requestFileContent:function(path,callback)
7729 {this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
7730 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded,errorHandler.bind(this));}
7731 function fileEntryLoaded(entry)
7732 {entry.file(fileLoaded,errorHandler.bind(this));}
7733 function fileLoaded(file)
7734 {var reader=new FileReader();reader.onloadend=readerLoadEnd;reader.readAsText(file);}
7735 function readerLoadEnd()
7736 {callback((this.result));}
7737 function errorHandler(error)
7738 {if(error.code===FileError.NOT_FOUND_ERR){callback(null);return;}
7739 var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when getting content for file '"+(this._path+"/"+path)+"'");callback(null);}},setFileContent:function(path,content,callback)
7740 {this._requestFileSystem(fileSystemLoaded);function fileSystemLoaded(fs)
7741 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,{create:true},fileEntryLoaded,errorHandler.bind(this));}
7742 function fileEntryLoaded(entry)
7743 {entry.createWriter(fileWriterCreated,errorHandler.bind(this));}
7744 function fileWriterCreated(fileWriter)
7745 {fileWriter.onerror=errorHandler.bind(this);fileWriter.onwriteend=fileTruncated;fileWriter.truncate(0);function fileTruncated()
7746 {fileWriter.onwriteend=writerEnd;var blob=new Blob([content],{type:"text/plain"});fileWriter.write(blob);}}
7747 function writerEnd()
7748 {callback();}
7749 function errorHandler(error)
7750 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when setting content for file '"+(this._path+"/"+path)+"'");callback();}},renameFile:function(path,newName,callback)
7751 {newName=newName?newName.trim():newName;if(!newName||newName.indexOf("/")!==-1){callback(false);return;}
7752 var fileEntry;var dirEntry;var newFileEntry;this._requestFileSystem(fileSystemLoaded);function fileSystemLoaded(fs)
7753 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded,errorHandler.bind(this));}
7754 function fileEntryLoaded(entry)
7755 {if(entry.name===newName){callback(false);return;}
7756 fileEntry=entry;fileEntry.getParent(dirEntryLoaded,errorHandler.bind(this));}
7757 function dirEntryLoaded(entry)
7758 {dirEntry=entry;dirEntry.getFile(newName,null,newFileEntryLoaded,newFileEntryLoadErrorHandler);}
7759 function newFileEntryLoaded(entry)
7760 {callback(false);}
7761 function newFileEntryLoadErrorHandler(error)
7762 {if(error.code!==FileError.NOT_FOUND_ERR){callback(false);return;}
7763 fileEntry.moveTo(dirEntry,newName,fileRenamed,errorHandler.bind(this));}
7764 function fileRenamed(entry)
7765 {callback(true,entry.name);}
7766 function errorHandler(error)
7767 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when renaming file '"+(this._path+"/"+path)+"' to '"+newName+"'");callback(false);}},_readDirectory:function(dirEntry,callback)
7768 {var dirReader=dirEntry.createReader();var entries=[];function innerCallback(results)
7769 {if(!results.length)
7770 callback(entries.sort());else{entries=entries.concat(toArray(results));dirReader.readEntries(innerCallback,errorHandler);}}
7771 function toArray(list)
7772 {return Array.prototype.slice.call(list||[],0);}
7773 dirReader.readEntries(innerCallback,errorHandler);function errorHandler(error)
7774 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when reading directory '"+dirEntry.fullPath+"'");callback([]);}},_requestEntries:function(domFileSystem,path,callback)
7775 {domFileSystem.root.getDirectory(path,null,innerCallback.bind(this),errorHandler);function innerCallback(dirEntry)
7776 {this._readDirectory(dirEntry,callback)}
7777 function errorHandler(error)
7778 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when requesting entry '"+path+"'");callback([]);}}}
7779 WebInspector.IsolatedFileSystemManager=function()
7780 {this._fileSystems={};this._pendingFileSystemRequests={};this._fileSystemMapping=new WebInspector.FileSystemMapping();if(this.supportsFileSystems())
7781 this._requestFileSystems();}
7782 WebInspector.IsolatedFileSystemManager.FileSystem;WebInspector.IsolatedFileSystemManager.Events={FileSystemAdded:"FileSystemAdded",FileSystemRemoved:"FileSystemRemoved"}
7783 WebInspector.IsolatedFileSystemManager.prototype={mapping:function()
7784 {return this._fileSystemMapping;},supportsFileSystems:function()
7785 {return InspectorFrontendHost.supportsFileSystems();},_requestFileSystems:function()
7786 {console.assert(!this._loaded);InspectorFrontendHost.requestFileSystems();},addFileSystem:function()
7787 {InspectorFrontendHost.addFileSystem();},removeFileSystem:function(fileSystemPath)
7788 {InspectorFrontendHost.removeFileSystem(fileSystemPath);},_fileSystemsLoaded:function(fileSystems)
7789 {var addedFileSystemPaths={};for(var i=0;i<fileSystems.length;++i){this._innerAddFileSystem(fileSystems[i]);addedFileSystemPaths[fileSystems[i].fileSystemPath]=true;}
7790 var fileSystemPaths=this._fileSystemMapping.fileSystemPaths();for(var i=0;i<fileSystemPaths.length;++i){var fileSystemPath=fileSystemPaths[i];if(!addedFileSystemPaths[fileSystemPath])
7791 this._fileSystemRemoved(fileSystemPath);}
7792 this._loaded=true;this._processPendingFileSystemRequests();},_innerAddFileSystem:function(fileSystem)
7793 {var fileSystemPath=fileSystem.fileSystemPath;this._fileSystemMapping.addFileSystem(fileSystemPath);var isolatedFileSystem=new WebInspector.IsolatedFileSystem(this,fileSystemPath,fileSystem.fileSystemName,fileSystem.rootURL);this._fileSystems[fileSystemPath]=isolatedFileSystem;this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded,isolatedFileSystem);},_fileSystemPaths:function()
7794 {return Object.keys(this._fileSystems);},_processPendingFileSystemRequests:function()
7795 {for(var fileSystemPath in this._pendingFileSystemRequests){var callbacks=this._pendingFileSystemRequests[fileSystemPath];for(var i=0;i<callbacks.length;++i)
7796 callbacks[i](this._isolatedFileSystem(fileSystemPath));}
7797 delete this._pendingFileSystemRequests;},_fileSystemAdded:function(errorMessage,fileSystem)
7798 {var fileSystemPath;if(errorMessage)
7799 WebInspector.showErrorMessage(errorMessage)
7800 else if(fileSystem){this._innerAddFileSystem(fileSystem);fileSystemPath=fileSystem.fileSystemPath;}},_fileSystemRemoved:function(fileSystemPath)
7801 {this._fileSystemMapping.removeFileSystem(fileSystemPath);var isolatedFileSystem=this._fileSystems[fileSystemPath];delete this._fileSystems[fileSystemPath];if(isolatedFileSystem)
7802 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved,isolatedFileSystem);},_isolatedFileSystem:function(fileSystemPath)
7803 {var fileSystem=this._fileSystems[fileSystemPath];if(!fileSystem)
7804 return null;if(!InspectorFrontendHost.isolatedFileSystem)
7805 return null;return InspectorFrontendHost.isolatedFileSystem(fileSystem.name(),fileSystem.rootURL());},requestDOMFileSystem:function(fileSystemPath,callback)
7806 {if(!this._loaded){if(!this._pendingFileSystemRequests[fileSystemPath])
7807 this._pendingFileSystemRequests[fileSystemPath]=this._pendingFileSystemRequests[fileSystemPath]||[];this._pendingFileSystemRequests[fileSystemPath].push(callback);return;}
7808 callback(this._isolatedFileSystem(fileSystemPath));},__proto__:WebInspector.Object.prototype}
7809 WebInspector.isolatedFileSystemManager;WebInspector.IsolatedFileSystemDispatcher=function(IsolatedFileSystemManager)
7810 {this._IsolatedFileSystemManager=IsolatedFileSystemManager;}
7811 WebInspector.IsolatedFileSystemDispatcher.prototype={fileSystemsLoaded:function(fileSystems)
7812 {this._IsolatedFileSystemManager._fileSystemsLoaded(fileSystems);},fileSystemRemoved:function(fileSystemPath)
7813 {this._IsolatedFileSystemManager._fileSystemRemoved(fileSystemPath);},fileSystemAdded:function(errorMessage,fileSystem)
7814 {this._IsolatedFileSystemManager._fileSystemAdded(errorMessage,fileSystem);}}
7815 WebInspector.isolatedFileSystemDispatcher;WebInspector.FileDescriptor=function(parentPath,name,originURL,url,contentType,isEditable,isContentScript)
7816 {this.parentPath=parentPath;this.name=name;this.originURL=originURL;this.url=url;this.contentType=contentType;this.isEditable=isEditable;this.isContentScript=isContentScript||false;}
7817 WebInspector.ProjectDelegate=function(){}
7818 WebInspector.ProjectDelegate.Events={FileAdded:"FileAdded",FileRemoved:"FileRemoved",Reset:"Reset",}
7819 WebInspector.ProjectDelegate.prototype={id:function(){},type:function(){},displayName:function(){},requestMetadata:function(path,callback){},requestFileContent:function(path,callback){},canSetFileContent:function(){},setFileContent:function(path,newContent,callback){},canRename:function(){},rename:function(path,newName,callback){},refresh:function(path){},excludeFolder:function(path){},createFile:function(path,name,content,callback){},deleteFile:function(path){},remove:function(){},searchInFileContent:function(path,query,caseSensitive,isRegex,callback){},findFilesMatchingSearchRequest:function(queries,fileQueries,caseSensitive,isRegex,progress,callback){},indexContent:function(progress,callback){}}
7820 WebInspector.Project=function(workspace,projectDelegate)
7821 {this._uiSourceCodesMap={};this._uiSourceCodesList=[];this._workspace=workspace;this._projectDelegate=projectDelegate;this._displayName=this._projectDelegate.displayName();this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileAdded,this._fileAdded,this);this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileRemoved,this._fileRemoved,this);this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.Reset,this._reset,this);}
7822 WebInspector.Project.prototype={id:function()
7823 {return this._projectDelegate.id();},type:function()
7824 {return this._projectDelegate.type();},displayName:function()
7825 {return this._displayName;},isServiceProject:function()
7826 {return this._projectDelegate.type()===WebInspector.projectTypes.Debugger||this._projectDelegate.type()===WebInspector.projectTypes.LiveEdit;},_fileAdded:function(event)
7827 {var fileDescriptor=(event.data);var path=fileDescriptor.parentPath?fileDescriptor.parentPath+"/"+fileDescriptor.name:fileDescriptor.name;var uiSourceCode=this.uiSourceCode(path);if(uiSourceCode)
7828 return;uiSourceCode=new WebInspector.UISourceCode(this,fileDescriptor.parentPath,fileDescriptor.name,fileDescriptor.originURL,fileDescriptor.url,fileDescriptor.contentType,fileDescriptor.isEditable);uiSourceCode.isContentScript=fileDescriptor.isContentScript;this._uiSourceCodesMap[path]={uiSourceCode:uiSourceCode,index:this._uiSourceCodesList.length};this._uiSourceCodesList.push(uiSourceCode);this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeAdded,uiSourceCode);},_fileRemoved:function(event)
7829 {var path=(event.data);this._removeFile(path);},_removeFile:function(path)
7830 {var uiSourceCode=this.uiSourceCode(path);if(!uiSourceCode)
7831 return;var entry=this._uiSourceCodesMap[path];var movedUISourceCode=this._uiSourceCodesList[this._uiSourceCodesList.length-1];this._uiSourceCodesList[entry.index]=movedUISourceCode;var movedEntry=this._uiSourceCodesMap[movedUISourceCode.path()];movedEntry.index=entry.index;this._uiSourceCodesList.splice(this._uiSourceCodesList.length-1,1);delete this._uiSourceCodesMap[path];this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeRemoved,entry.uiSourceCode);},_reset:function()
7832 {this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectWillReset,this);this._uiSourceCodesMap={};this._uiSourceCodesList=[];},workspace:function()
7833 {return this._workspace;},uiSourceCode:function(path)
7834 {var entry=this._uiSourceCodesMap[path];return entry?entry.uiSourceCode:null;},uiSourceCodeForOriginURL:function(originURL)
7835 {for(var i=0;i<this._uiSourceCodesList.length;++i){var uiSourceCode=this._uiSourceCodesList[i];if(uiSourceCode.originURL()===originURL)
7836 return uiSourceCode;}
7837 return null;},uiSourceCodes:function()
7838 {return this._uiSourceCodesList;},requestMetadata:function(uiSourceCode,callback)
7839 {this._projectDelegate.requestMetadata(uiSourceCode.path(),callback);},requestFileContent:function(uiSourceCode,callback)
7840 {this._projectDelegate.requestFileContent(uiSourceCode.path(),callback);},canSetFileContent:function()
7841 {return this._projectDelegate.canSetFileContent();},setFileContent:function(uiSourceCode,newContent,callback)
7842 {this._projectDelegate.setFileContent(uiSourceCode.path(),newContent,onSetContent.bind(this));function onSetContent(content)
7843 {this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted,{uiSourceCode:uiSourceCode,content:newContent});callback(content);}},canRename:function()
7844 {return this._projectDelegate.canRename();},rename:function(uiSourceCode,newName,callback)
7845 {if(newName===uiSourceCode.name()){callback(true,uiSourceCode.name(),uiSourceCode.url,uiSourceCode.originURL(),uiSourceCode.contentType());return;}
7846 this._projectDelegate.rename(uiSourceCode.path(),newName,innerCallback.bind(this));function innerCallback(success,newName,newURL,newOriginURL,newContentType)
7847 {if(!success||!newName){callback(false);return;}
7848 var oldPath=uiSourceCode.path();var newPath=uiSourceCode.parentPath()?uiSourceCode.parentPath()+"/"+newName:newName;this._uiSourceCodesMap[newPath]=this._uiSourceCodesMap[oldPath];delete this._uiSourceCodesMap[oldPath];callback(true,newName,newURL,newOriginURL,newContentType);}},refresh:function(path)
7849 {this._projectDelegate.refresh(path);},excludeFolder:function(path)
7850 {this._projectDelegate.excludeFolder(path);var uiSourceCodes=this._uiSourceCodesList.slice();for(var i=0;i<uiSourceCodes.length;++i){var uiSourceCode=uiSourceCodes[i];if(uiSourceCode.path().startsWith(path.substr(1)))
7851 this._removeFile(uiSourceCode.path());}},createFile:function(path,name,content,callback)
7852 {this._projectDelegate.createFile(path,name,content,innerCallback);function innerCallback(filePath)
7853 {callback(filePath);}},deleteFile:function(path)
7854 {this._projectDelegate.deleteFile(path);},remove:function()
7855 {this._projectDelegate.remove();},searchInFileContent:function(uiSourceCode,query,caseSensitive,isRegex,callback)
7856 {this._projectDelegate.searchInFileContent(uiSourceCode.path(),query,caseSensitive,isRegex,callback);},findFilesMatchingSearchRequest:function(queries,fileQueries,caseSensitive,isRegex,progress,callback)
7857 {this._projectDelegate.findFilesMatchingSearchRequest(queries,fileQueries,caseSensitive,isRegex,progress,callback);},indexContent:function(progress,callback)
7858 {this._projectDelegate.indexContent(progress,callback);},dispose:function()
7859 {this._projectDelegate.reset();}}
7860 WebInspector.projectTypes={Debugger:"debugger",LiveEdit:"liveedit",Network:"network",Snippets:"snippets",FileSystem:"filesystem"}
7861 WebInspector.Workspace=function(fileSystemMapping)
7862 {this._fileSystemMapping=fileSystemMapping;this._projects={};this._hasResourceContentTrackingExtensions=false;}
7863 WebInspector.Workspace.Events={UISourceCodeAdded:"UISourceCodeAdded",UISourceCodeRemoved:"UISourceCodeRemoved",UISourceCodeContentCommitted:"UISourceCodeContentCommitted",ProjectWillReset:"ProjectWillReset"}
7864 WebInspector.Workspace.prototype={unsavedSourceCodes:function()
7865 {function filterUnsaved(sourceCode)
7866 {return sourceCode.isDirty();}
7867 return this.uiSourceCodes().filter(filterUnsaved);},uiSourceCode:function(projectId,path)
7868 {var project=this._projects[projectId];return project?project.uiSourceCode(path):null;},uiSourceCodeForOriginURL:function(originURL)
7869 {var networkProjects=this.projectsForType(WebInspector.projectTypes.Network)
7870 for(var i=0;i<networkProjects.length;++i){var project=networkProjects[i];var uiSourceCode=project.uiSourceCodeForOriginURL(originURL);if(uiSourceCode)
7871 return uiSourceCode;}
7872 return null;},uiSourceCodesForProjectType:function(type)
7873 {var result=[];for(var projectName in this._projects){var project=this._projects[projectName];if(project.type()===type)
7874 result=result.concat(project.uiSourceCodes());}
7875 return result;},addProject:function(projectDelegate)
7876 {var projectId=projectDelegate.id();this._projects[projectId]=new WebInspector.Project(this,projectDelegate);return this._projects[projectId];},removeProject:function(projectId)
7877 {var project=this._projects[projectId];if(!project)
7878 return;project.dispose();delete this._projects[projectId];},project:function(projectId)
7879 {return this._projects[projectId];},projects:function()
7880 {return Object.values(this._projects);},projectsForType:function(type)
7881 {function filterByType(project)
7882 {return project.type()===type;}
7883 return this.projects().filter(filterByType);},uiSourceCodes:function()
7884 {var result=[];for(var projectId in this._projects){var project=this._projects[projectId];result=result.concat(project.uiSourceCodes());}
7885 return result;},hasMappingForURL:function(url)
7886 {if(!InspectorFrontendHost.supportsFileSystems())
7887 return false;return this._fileSystemMapping.hasMappingForURL(url);},_networkUISourceCodeForURL:function(url)
7888 {var splitURL=WebInspector.ParsedURL.splitURL(url);var projectId=WebInspector.SimpleProjectDelegate.projectId(splitURL[0],WebInspector.projectTypes.Network);var project=this.project(projectId);return project?project.uiSourceCode(splitURL.slice(1).join("/")):null;},uiSourceCodeForURL:function(url)
7889 {if(!InspectorFrontendHost.supportsFileSystems())
7890 return this._networkUISourceCodeForURL(url);var file=this._fileSystemMapping.fileForURL(url);if(!file)
7891 return this._networkUISourceCodeForURL(url);var projectId=WebInspector.FileSystemProjectDelegate.projectId(file.fileSystemPath);var project=this.project(projectId);return project?project.uiSourceCode(file.filePath):null;},urlForPath:function(fileSystemPath,filePath)
7892 {return this._fileSystemMapping.urlForPath(fileSystemPath,filePath);},addMapping:function(networkUISourceCode,uiSourceCode,fileSystemWorkspaceProvider)
7893 {var url=networkUISourceCode.url;var path=uiSourceCode.path();var fileSystemPath=fileSystemWorkspaceProvider.fileSystemPath(uiSourceCode);this._fileSystemMapping.addMappingForResource(url,fileSystemPath,path);WebInspector.suggestReload();},removeMapping:function(uiSourceCode)
7894 {this._fileSystemMapping.removeMappingForURL(uiSourceCode.url);WebInspector.suggestReload();},setHasResourceContentTrackingExtensions:function(hasExtensions)
7895 {this._hasResourceContentTrackingExtensions=hasExtensions;},hasResourceContentTrackingExtensions:function()
7896 {return this._hasResourceContentTrackingExtensions;},__proto__:WebInspector.Object.prototype}
7897 WebInspector.workspace;WebInspector.WorkspaceController=function(workspace)
7898 {this._workspace=workspace;WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._inspectedURLChanged,this);window.addEventListener("focus",this._windowFocused.bind(this),false);}
7899 WebInspector.WorkspaceController.prototype={_inspectedURLChanged:function(event)
7900 {WebInspector.Revision.filterOutStaleRevisions();},_windowFocused:function(event)
7901 {if(this._fileSystemRefreshTimeout)
7902 return;this._fileSystemRefreshTimeout=setTimeout(refreshFileSystems.bind(this),1000);function refreshFileSystems()
7903 {delete this._fileSystemRefreshTimeout;var projects=this._workspace.projects();for(var i=0;i<projects.length;++i)
7904 projects[i].refresh("/");}}}
7905 WebInspector.ContentProviderBasedProjectDelegate=function(type)
7906 {this._type=type;this._contentProviders={};this._isContentScriptMap={};}
7907 WebInspector.ContentProviderBasedProjectDelegate.prototype={id:function()
7908 {return"";},type:function()
7909 {return this._type;},displayName:function()
7910 {return"";},requestMetadata:function(path,callback)
7911 {callback(null,null);},requestFileContent:function(path,callback)
7912 {var contentProvider=this._contentProviders[path];contentProvider.requestContent(callback);function innerCallback(content,encoded,mimeType)
7913 {callback(content);}},canSetFileContent:function()
7914 {return false;},setFileContent:function(path,newContent,callback)
7915 {callback(null);},canRename:function()
7916 {return false;},rename:function(path,newName,callback)
7917 {this.performRename(path,newName,innerCallback.bind(this));function innerCallback(success,newName)
7918 {if(success)
7919 this._updateName(path,(newName));callback(success,newName);}},refresh:function(path)
7920 {},excludeFolder:function(path)
7921 {},createFile:function(path,name,content,callback)
7922 {},deleteFile:function(path)
7923 {},remove:function()
7924 {},performRename:function(path,newName,callback)
7925 {callback(false);},_updateName:function(path,newName)
7926 {var oldPath=path;var copyOfPath=path.split("/");copyOfPath[copyOfPath.length-1]=newName;var newPath=copyOfPath.join("/");this._contentProviders[newPath]=this._contentProviders[oldPath];delete this._contentProviders[oldPath];},searchInFileContent:function(path,query,caseSensitive,isRegex,callback)
7927 {var contentProvider=this._contentProviders[path];contentProvider.searchInContent(query,caseSensitive,isRegex,callback);},findFilesMatchingSearchRequest:function(queries,fileQueries,caseSensitive,isRegex,progress,callback)
7928 {var result=[];var paths=Object.keys(this._contentProviders);var totalCount=paths.length;if(totalCount===0){setTimeout(doneCallback,0);return;}
7929 function filterOutContentScripts(path)
7930 {return!this._isContentScriptMap[path];}
7931 if(!WebInspector.settings.searchInContentScripts.get())
7932 paths=paths.filter(filterOutContentScripts.bind(this));var fileRegexes=[];for(var i=0;i<fileQueries.length;++i)
7933 fileRegexes.push(new RegExp(fileQueries[i],caseSensitive?"":"i"));function filterOutNonMatchingFiles(file)
7934 {for(var i=0;i<fileRegexes.length;++i){if(!file.match(fileRegexes[i]))
7935 return false;}
7936 return true;}
7937 paths=paths.filter(filterOutNonMatchingFiles);var barrier=new CallbackBarrier();progress.setTotalWork(paths.length);for(var i=0;i<paths.length;++i)
7938 searchInContent.call(this,paths[i],barrier.createCallback(searchInContentCallback.bind(this,paths[i])));barrier.callWhenDone(doneCallback);function searchInContent(path,callback)
7939 {var queriesToRun=queries.slice();searchNextQuery.call(this);function searchNextQuery()
7940 {if(!queriesToRun.length){callback(true);return;}
7941 var query=queriesToRun.shift();this._contentProviders[path].searchInContent(query,caseSensitive,isRegex,contentCallback.bind(this));}
7942 function contentCallback(searchMatches)
7943 {if(!searchMatches.length){callback(false);return;}
7944 searchNextQuery.call(this);}}
7945 function searchInContentCallback(path,matches)
7946 {if(matches)
7947 result.push(path);progress.worked(1);}
7948 function doneCallback()
7949 {callback(result);progress.done();}},indexContent:function(progress,callback)
7950 {setTimeout(innerCallback,0);function innerCallback()
7951 {progress.done();callback();}},addContentProvider:function(parentPath,name,url,contentProvider,isEditable,isContentScript)
7952 {var path=parentPath?parentPath+"/"+name:name;var fileDescriptor=new WebInspector.FileDescriptor(parentPath,name,url,url,contentProvider.contentType(),isEditable,isContentScript);this._contentProviders[path]=contentProvider;this._isContentScriptMap[path]=isContentScript||false;this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded,fileDescriptor);return path;},removeFile:function(path)
7953 {delete this._contentProviders[path];delete this._isContentScriptMap[path];this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved,path);},contentProviders:function()
7954 {return this._contentProviders;},reset:function()
7955 {this._contentProviders={};this._isContentScriptMap={};this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.Reset,null);},__proto__:WebInspector.Object.prototype}
7956 WebInspector.SimpleProjectDelegate=function(name,type)
7957 {WebInspector.ContentProviderBasedProjectDelegate.call(this,type);this._name=name;this._lastUniqueSuffix=0;}
7958 WebInspector.SimpleProjectDelegate.projectId=function(name,type)
7959 {var typePrefix=type!==WebInspector.projectTypes.Network?(type+":"):"";return typePrefix+name;}
7960 WebInspector.SimpleProjectDelegate.prototype={id:function()
7961 {return WebInspector.SimpleProjectDelegate.projectId(this._name,this.type());},displayName:function()
7962 {if(typeof this._displayName!=="undefined")
7963 return this._displayName;if(!this._name){this._displayName=this.type()!==WebInspector.projectTypes.Snippets?WebInspector.UIString("(no domain)"):"";return this._displayName;}
7964 var parsedURL=new WebInspector.ParsedURL(this._name);if(parsedURL.isValid){this._displayName=parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"");if(!this._displayName)
7965 this._displayName=this._name;}
7966 else
7967 this._displayName=this._name;return this._displayName;},addFile:function(parentPath,name,forceUniquePath,url,contentProvider,isEditable,isContentScript)
7968 {if(forceUniquePath)
7969 name=this._ensureUniqueName(parentPath,name);return this.addContentProvider(parentPath,name,url,contentProvider,isEditable,isContentScript);},_ensureUniqueName:function(parentPath,name)
7970 {var path=parentPath?parentPath+"/"+name:name;var uniquePath=path;var suffix="";var contentProviders=this.contentProviders();while(contentProviders[uniquePath]){suffix=" ("+(++this._lastUniqueSuffix)+")";uniquePath=path+suffix;}
7971 return name+suffix;},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
7972 WebInspector.SimpleWorkspaceProvider=function(workspace,type)
7973 {this._workspace=workspace;this._type=type;this._simpleProjectDelegates={};}
7974 WebInspector.SimpleWorkspaceProvider.prototype={_projectDelegate:function(projectName)
7975 {if(this._simpleProjectDelegates[projectName])
7976 return this._simpleProjectDelegates[projectName];var simpleProjectDelegate=new WebInspector.SimpleProjectDelegate(projectName,this._type);this._simpleProjectDelegates[projectName]=simpleProjectDelegate;this._workspace.addProject(simpleProjectDelegate);return simpleProjectDelegate;},addFileForURL:function(url,contentProvider,isEditable,isContentScript)
7977 {return this._innerAddFileForURL(url,contentProvider,isEditable,false,isContentScript);},addUniqueFileForURL:function(url,contentProvider,isEditable,isContentScript)
7978 {return this._innerAddFileForURL(url,contentProvider,isEditable,true,isContentScript);},_innerAddFileForURL:function(url,contentProvider,isEditable,forceUnique,isContentScript)
7979 {var splitURL=WebInspector.ParsedURL.splitURL(url);var projectName=splitURL[0];var parentPath=splitURL.slice(1,splitURL.length-1).join("/");var name=splitURL[splitURL.length-1];var projectDelegate=this._projectDelegate(projectName);var path=projectDelegate.addFile(parentPath,name,forceUnique,url,contentProvider,isEditable,isContentScript);var uiSourceCode=(this._workspace.uiSourceCode(projectDelegate.id(),path));console.assert(uiSourceCode);return uiSourceCode;},reset:function()
7980 {for(var projectName in this._simpleProjectDelegates)
7981 this._simpleProjectDelegates[projectName].reset();this._simpleProjectDelegates={};},__proto__:WebInspector.Object.prototype}
7982 WebInspector.BreakpointManager=function(breakpointStorage,debuggerModel,workspace)
7983 {this._storage=new WebInspector.BreakpointManager.Storage(this,breakpointStorage);this._debuggerModel=debuggerModel;this._workspace=workspace;this._breakpointForDebuggerId={};this._breakpointsForUISourceCode=new Map();this._breakpointsForPrimaryUISourceCode=new Map();this._sourceFilesWithRestoredBreakpoints={};this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved,this._breakpointResolved,this);this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset,this._projectWillReset,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);}
7984 WebInspector.BreakpointManager.Events={BreakpointAdded:"breakpoint-added",BreakpointRemoved:"breakpoint-removed"}
7985 WebInspector.BreakpointManager._sourceFileId=function(uiSourceCode)
7986 {if(!uiSourceCode.url)
7987 return"";var deobfuscatedPrefix=uiSourceCode.formatted()?"deobfuscated:":"";return deobfuscatedPrefix+uiSourceCode.uri();}
7988 WebInspector.BreakpointManager._breakpointStorageId=function(sourceFileId,lineNumber)
7989 {if(!sourceFileId)
7990 return"";return sourceFileId+":"+lineNumber;}
7991 WebInspector.BreakpointManager.prototype={_provisionalBreakpointsForSourceFileId:function(sourceFileId)
7992 {var result=new StringMap();for(var debuggerId in this._breakpointForDebuggerId){var breakpoint=this._breakpointForDebuggerId[debuggerId];if(breakpoint._sourceFileId===sourceFileId)
7993 result.put(breakpoint._breakpointStorageId(),breakpoint);}
7994 return result;},_restoreBreakpoints:function(uiSourceCode)
7995 {var sourceFileId=WebInspector.BreakpointManager._sourceFileId(uiSourceCode);if(!sourceFileId||this._sourceFilesWithRestoredBreakpoints[sourceFileId])
7996 return;this._sourceFilesWithRestoredBreakpoints[sourceFileId]=true;this._storage.mute();var breakpointItems=this._storage.breakpointItems(uiSourceCode);var provisionalBreakpoints=this._provisionalBreakpointsForSourceFileId(sourceFileId);for(var i=0;i<breakpointItems.length;++i){var breakpointItem=breakpointItems[i];var itemStorageId=WebInspector.BreakpointManager._breakpointStorageId(breakpointItem.sourceFileId,breakpointItem.lineNumber);var provisionalBreakpoint=provisionalBreakpoints.get(itemStorageId);if(provisionalBreakpoint){if(!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode))
7997 this._breakpointsForPrimaryUISourceCode.put(uiSourceCode,[]);this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(provisionalBreakpoint);provisionalBreakpoint._updateInDebugger();}else{this._innerSetBreakpoint(uiSourceCode,breakpointItem.lineNumber,breakpointItem.condition,breakpointItem.enabled);}}
7998 this._storage.unmute();},_uiSourceCodeAdded:function(event)
7999 {var uiSourceCode=(event.data);this._restoreBreakpoints(uiSourceCode);if(uiSourceCode.contentType()===WebInspector.resourceTypes.Script||uiSourceCode.contentType()===WebInspector.resourceTypes.Document){uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged,this._uiSourceCodeMappingChanged,this);uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged,this._uiSourceCodeFormatted,this);}},_uiSourceCodeFormatted:function(event)
8000 {var uiSourceCode=(event.target);this._restoreBreakpoints(uiSourceCode);},_uiSourceCodeRemoved:function(event)
8001 {var uiSourceCode=(event.data);this._removeUISourceCode(uiSourceCode);},_uiSourceCodeMappingChanged:function(event)
8002 {var uiSourceCode=(event.target);var breakpoints=this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[];for(var i=0;i<breakpoints.length;++i)
8003 breakpoints[i]._updateInDebugger();},_removeUISourceCode:function(uiSourceCode)
8004 {var breakpoints=this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[];for(var i=0;i<breakpoints.length;++i)
8005 breakpoints[i]._resetLocations();var sourceFileId=WebInspector.BreakpointManager._sourceFileId(uiSourceCode);delete this._sourceFilesWithRestoredBreakpoints[sourceFileId];uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.FormattedChanged,this._uiSourceCodeFormatted,this);uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged,this._uiSourceCodeMappingChanged,this);this._breakpointsForPrimaryUISourceCode.remove(uiSourceCode);},setBreakpoint:function(uiSourceCode,lineNumber,condition,enabled)
8006 {this._debuggerModel.setBreakpointsActive(true);return this._innerSetBreakpoint(uiSourceCode,lineNumber,condition,enabled);},_innerSetBreakpoint:function(uiSourceCode,lineNumber,condition,enabled)
8007 {var breakpoint=this.findBreakpoint(uiSourceCode,lineNumber);if(breakpoint){breakpoint._updateBreakpoint(condition,enabled);return breakpoint;}
8008 var projectId=uiSourceCode.project().id();var path=uiSourceCode.path();var sourceFileId=WebInspector.BreakpointManager._sourceFileId(uiSourceCode);breakpoint=new WebInspector.BreakpointManager.Breakpoint(this,projectId,path,sourceFileId,lineNumber,condition,enabled);if(!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode))
8009 this._breakpointsForPrimaryUISourceCode.put(uiSourceCode,[]);this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(breakpoint);return breakpoint;},findBreakpoint:function(uiSourceCode,lineNumber)
8010 {var breakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var lineBreakpoints=breakpoints?breakpoints[lineNumber]:null;return lineBreakpoints?lineBreakpoints[0]:null;},breakpointsForUISourceCode:function(uiSourceCode)
8011 {var breakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var allLineBreakpoints=breakpoints?Object.values(breakpoints):[];var result=[];for(var i=0;i<allLineBreakpoints.length;++i)
8012 result=result.concat(allLineBreakpoints[i]);return result;},allBreakpoints:function()
8013 {var result=[];var uiSourceCodes=this._breakpointsForUISourceCode.keys();for(var i=0;i<uiSourceCodes.length;++i)
8014 result=result.concat(this.breakpointsForUISourceCode(uiSourceCodes[i]));return result;},breakpointLocationsForUISourceCode:function(uiSourceCode)
8015 {var breakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var breakpointLines=breakpoints?Object.keys(breakpoints):[];var result=[];for(var i=0;i<breakpointLines.length;++i){var lineNumber=parseInt(breakpointLines[i],10);if(isNaN(lineNumber))
8016 continue;var lineBreakpoints=breakpoints[lineNumber];for(var j=0;j<lineBreakpoints.length;++j){var breakpoint=lineBreakpoints[j];var uiLocation=new WebInspector.UILocation(uiSourceCode,lineNumber,0);result.push({breakpoint:breakpoint,uiLocation:uiLocation});}}
8017 return result;},allBreakpointLocations:function()
8018 {var result=[];var uiSourceCodes=this._breakpointsForUISourceCode.keys();for(var i=0;i<uiSourceCodes.length;++i)
8019 result=result.concat(this.breakpointLocationsForUISourceCode(uiSourceCodes[i]));return result;},toggleAllBreakpoints:function(toggleState)
8020 {var breakpoints=this.allBreakpoints();for(var i=0;i<breakpoints.length;++i)
8021 breakpoints[i].setEnabled(toggleState);},removeAllBreakpoints:function()
8022 {var breakpoints=this.allBreakpoints();for(var i=0;i<breakpoints.length;++i)
8023 breakpoints[i].remove();},removeProvisionalBreakpoints:function()
8024 {for(var debuggerId in this._breakpointForDebuggerId)
8025 this._debuggerModel.removeBreakpoint(debuggerId);},_projectWillReset:function(event)
8026 {var project=(event.data);var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
8027 this._removeUISourceCode(uiSourceCodes[i]);},_breakpointResolved:function(event)
8028 {var breakpointId=(event.data.breakpointId);var location=(event.data.location);var breakpoint=this._breakpointForDebuggerId[breakpointId];if(!breakpoint)
8029 return;breakpoint._addResolvedLocation(location);},_removeBreakpoint:function(breakpoint,removeFromStorage)
8030 {var uiSourceCode=breakpoint.uiSourceCode();var breakpoints=uiSourceCode?this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[]:[];var index=breakpoints.indexOf(breakpoint);if(index>-1)
8031 breakpoints.splice(index,1);console.assert(!breakpoint._debuggerId)
8032 if(removeFromStorage)
8033 this._storage._removeBreakpoint(breakpoint);},_uiLocationAdded:function(breakpoint,uiLocation)
8034 {var breakpoints=this._breakpointsForUISourceCode.get(uiLocation.uiSourceCode);if(!breakpoints){breakpoints={};this._breakpointsForUISourceCode.put(uiLocation.uiSourceCode,breakpoints);}
8035 var lineBreakpoints=breakpoints[uiLocation.lineNumber];if(!lineBreakpoints){lineBreakpoints=[];breakpoints[uiLocation.lineNumber]=lineBreakpoints;}
8036 lineBreakpoints.push(breakpoint);this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.BreakpointAdded,{breakpoint:breakpoint,uiLocation:uiLocation});},_uiLocationRemoved:function(breakpoint,uiLocation)
8037 {var breakpoints=this._breakpointsForUISourceCode.get(uiLocation.uiSourceCode);if(!breakpoints)
8038 return;var lineBreakpoints=breakpoints[uiLocation.lineNumber];if(!lineBreakpoints)
8039 return;lineBreakpoints.remove(breakpoint);if(!lineBreakpoints.length)
8040 delete breakpoints[uiLocation.lineNumber];if(Object.keys(breakpoints).length===0)
8041 this._breakpointsForUISourceCode.remove(uiLocation.uiSourceCode);this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.BreakpointRemoved,{breakpoint:breakpoint,uiLocation:uiLocation});},__proto__:WebInspector.Object.prototype}
8042 WebInspector.BreakpointManager.Breakpoint=function(breakpointManager,projectId,path,sourceFileId,lineNumber,condition,enabled)
8043 {this._breakpointManager=breakpointManager;this._projectId=projectId;this._path=path;this._lineNumber=lineNumber;this._sourceFileId=sourceFileId;this._liveLocations=[];this._uiLocations={};this._condition;this._enabled;this._updateBreakpoint(condition,enabled);}
8044 WebInspector.BreakpointManager.Breakpoint.prototype={projectId:function()
8045 {return this._projectId;},path:function()
8046 {return this._path;},lineNumber:function()
8047 {return this._lineNumber;},uiSourceCode:function()
8048 {return this._breakpointManager._workspace.uiSourceCode(this._projectId,this._path);},_addResolvedLocation:function(location)
8049 {this._liveLocations.push(this._breakpointManager._debuggerModel.createLiveLocation(location,this._locationUpdated.bind(this,location)));},_locationUpdated:function(location,uiLocation)
8050 {var stringifiedLocation=location.scriptId+":"+location.lineNumber+":"+location.columnNumber;var oldUILocation=(this._uiLocations[stringifiedLocation]);if(oldUILocation)
8051 this._breakpointManager._uiLocationRemoved(this,oldUILocation);if(this._uiLocations[""]){var defaultLocation=this._uiLocations[""];delete this._uiLocations[""];this._breakpointManager._uiLocationRemoved(this,defaultLocation);}
8052 this._uiLocations[stringifiedLocation]=uiLocation;this._breakpointManager._uiLocationAdded(this,uiLocation);},enabled:function()
8053 {return this._enabled;},setEnabled:function(enabled)
8054 {this._updateBreakpoint(this._condition,enabled);},condition:function()
8055 {return this._condition;},setCondition:function(condition)
8056 {this._updateBreakpoint(condition,this._enabled);},_updateBreakpoint:function(condition,enabled)
8057 {if(this._enabled===enabled&&this._condition===condition)
8058 return;this._removeFromDebugger();this._enabled=enabled;this._condition=condition;this._breakpointManager._storage._updateBreakpoint(this);this._fakeBreakpointAtPrimaryLocation();this._updateInDebugger();},_updateInDebugger:function()
8059 {var uiSourceCode=this.uiSourceCode();if(!uiSourceCode||!uiSourceCode.hasSourceMapping())
8060 return;var scriptFile=uiSourceCode&&uiSourceCode.scriptFile();if(this._enabled&&!(scriptFile&&scriptFile.hasDivergedFromVM()))
8061 this._setInDebugger();},remove:function(keepInStorage)
8062 {var removeFromStorage=!keepInStorage;this._resetLocations();this._removeFromDebugger();this._breakpointManager._removeBreakpoint(this,removeFromStorage);},_setInDebugger:function()
8063 {this._removeFromDebugger();var uiSourceCode=this._breakpointManager._workspace.uiSourceCode(this._projectId,this._path);if(!uiSourceCode)
8064 return;var rawLocation=uiSourceCode.uiLocationToRawLocation(this._lineNumber,0);var debuggerModelLocation=(rawLocation);if(debuggerModelLocation)
8065 this._breakpointManager._debuggerModel.setBreakpointByScriptLocation(debuggerModelLocation,this._condition,this._didSetBreakpointInDebugger.bind(this));else if(uiSourceCode.url)
8066 this._breakpointManager._debuggerModel.setBreakpointByURL(uiSourceCode.url,this._lineNumber,0,this._condition,this._didSetBreakpointInDebugger.bind(this));},_didSetBreakpointInDebugger:function(breakpointId,locations)
8067 {if(!breakpointId){this._resetLocations();this._breakpointManager._removeBreakpoint(this,false);return;}
8068 this._debuggerId=breakpointId;this._breakpointManager._breakpointForDebuggerId[breakpointId]=this;if(!locations.length){this._fakeBreakpointAtPrimaryLocation();return;}
8069 this._resetLocations();for(var i=0;i<locations.length;++i){var script=this._breakpointManager._debuggerModel.scriptForId(locations[i].scriptId);var uiLocation=script.rawLocationToUILocation(locations[i].lineNumber,locations[i].columnNumber);if(this._breakpointManager.findBreakpoint(uiLocation.uiSourceCode,uiLocation.lineNumber)){this.remove();return;}}
8070 for(var i=0;i<locations.length;++i)
8071 this._addResolvedLocation(locations[i]);},_removeFromDebugger:function()
8072 {if(!this._debuggerId)
8073 return;this._breakpointManager._debuggerModel.removeBreakpoint(this._debuggerId);delete this._breakpointManager._breakpointForDebuggerId[this._debuggerId];delete this._debuggerId;},_resetLocations:function()
8074 {for(var stringifiedLocation in this._uiLocations)
8075 this._breakpointManager._uiLocationRemoved(this,this._uiLocations[stringifiedLocation]);for(var i=0;i<this._liveLocations.length;++i)
8076 this._liveLocations[i].dispose();this._liveLocations=[];this._uiLocations={};},_breakpointStorageId:function()
8077 {return WebInspector.BreakpointManager._breakpointStorageId(this._sourceFileId,this._lineNumber);},_fakeBreakpointAtPrimaryLocation:function()
8078 {this._resetLocations();var uiSourceCode=this._breakpointManager._workspace.uiSourceCode(this._projectId,this._path);if(!uiSourceCode)
8079 return;var uiLocation=new WebInspector.UILocation(uiSourceCode,this._lineNumber,0);this._uiLocations[""]=uiLocation;this._breakpointManager._uiLocationAdded(this,uiLocation);}}
8080 WebInspector.BreakpointManager.Storage=function(breakpointManager,setting)
8081 {this._breakpointManager=breakpointManager;this._setting=setting;var breakpoints=this._setting.get();this._breakpoints={};for(var i=0;i<breakpoints.length;++i){var breakpoint=(breakpoints[i]);this._breakpoints[breakpoint.sourceFileId+":"+breakpoint.lineNumber]=breakpoint;}}
8082 WebInspector.BreakpointManager.Storage.prototype={mute:function()
8083 {this._muted=true;},unmute:function()
8084 {delete this._muted;},breakpointItems:function(uiSourceCode)
8085 {var result=[];var sourceFileId=WebInspector.BreakpointManager._sourceFileId(uiSourceCode);for(var id in this._breakpoints){var breakpoint=this._breakpoints[id];if(breakpoint.sourceFileId===sourceFileId)
8086 result.push(breakpoint);}
8087 return result;},_updateBreakpoint:function(breakpoint)
8088 {if(this._muted||!breakpoint._breakpointStorageId())
8089 return;this._breakpoints[breakpoint._breakpointStorageId()]=new WebInspector.BreakpointManager.Storage.Item(breakpoint);this._save();},_removeBreakpoint:function(breakpoint)
8090 {if(this._muted)
8091 return;delete this._breakpoints[breakpoint._breakpointStorageId()];this._save();},_save:function()
8092 {var breakpointsArray=[];for(var id in this._breakpoints)
8093 breakpointsArray.push(this._breakpoints[id]);this._setting.set(breakpointsArray);}}
8094 WebInspector.BreakpointManager.Storage.Item=function(breakpoint)
8095 {this.sourceFileId=breakpoint._sourceFileId;this.lineNumber=breakpoint.lineNumber();this.condition=breakpoint.condition();this.enabled=breakpoint.enabled();}
8096 WebInspector.breakpointManager;WebInspector.ConcatenatedScriptsContentProvider=function(scripts)
8097 {this._scripts=scripts;}
8098 WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag="<script>";WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag="</script>";WebInspector.ConcatenatedScriptsContentProvider.prototype={_sortedScripts:function()
8099 {if(this._sortedScriptsArray)
8100 return this._sortedScriptsArray;this._sortedScriptsArray=[];var scripts=this._scripts.slice();scripts.sort(function(x,y){return x.lineOffset-y.lineOffset||x.columnOffset-y.columnOffset;});var scriptOpenTagLength=WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag.length;var scriptCloseTagLength=WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag.length;this._sortedScriptsArray.push(scripts[0]);for(var i=1;i<scripts.length;++i){var previousScript=this._sortedScriptsArray[this._sortedScriptsArray.length-1];var lineNumber=previousScript.endLine;var columnNumber=previousScript.endColumn+scriptCloseTagLength+scriptOpenTagLength;if(lineNumber<scripts[i].lineOffset||(lineNumber===scripts[i].lineOffset&&columnNumber<=scripts[i].columnOffset))
8101 this._sortedScriptsArray.push(scripts[i]);}
8102 return this._sortedScriptsArray;},contentURL:function()
8103 {return"";},contentType:function()
8104 {return WebInspector.resourceTypes.Document;},requestContent:function(callback)
8105 {var scripts=this._sortedScripts();var sources=[];function didRequestSource(content)
8106 {sources.push(content);if(sources.length==scripts.length)
8107 callback(this._concatenateScriptsContent(scripts,sources));}
8108 for(var i=0;i<scripts.length;++i)
8109 scripts[i].requestContent(didRequestSource.bind(this));},searchInContent:function(query,caseSensitive,isRegex,callback)
8110 {var results={};var scripts=this._sortedScripts();var scriptsLeft=scripts.length;function maybeCallback()
8111 {if(scriptsLeft)
8112 return;var result=[];for(var i=0;i<scripts.length;++i)
8113 result=result.concat(results[scripts[i].scriptId]);callback(result);}
8114 function searchCallback(script,searchMatches)
8115 {results[script.scriptId]=[];for(var i=0;i<searchMatches.length;++i){var searchMatch=new WebInspector.ContentProvider.SearchMatch(searchMatches[i].lineNumber+script.lineOffset,searchMatches[i].lineContent);results[script.scriptId].push(searchMatch);}
8116 scriptsLeft--;maybeCallback.call(this);}
8117 maybeCallback();for(var i=0;i<scripts.length;++i)
8118 scripts[i].searchInContent(query,caseSensitive,isRegex,searchCallback.bind(this,scripts[i]));},_concatenateScriptsContent:function(scripts,sources)
8119 {var content="";var lineNumber=0;var columnNumber=0;var scriptOpenTag=WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag;var scriptCloseTag=WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag;for(var i=0;i<scripts.length;++i){for(var newLinesCount=scripts[i].lineOffset-lineNumber;newLinesCount>0;--newLinesCount){columnNumber=0;content+="\n";}
8120 for(var spacesCount=scripts[i].columnOffset-columnNumber-scriptOpenTag.length;spacesCount>0;--spacesCount)
8121 content+=" ";content+=scriptOpenTag;content+=sources[i];content+=scriptCloseTag;lineNumber=scripts[i].endLine;columnNumber=scripts[i].endColumn+scriptCloseTag.length;}
8122 return content;}}
8123 WebInspector.CompilerSourceMappingContentProvider=function(sourceURL,contentType)
8124 {this._sourceURL=sourceURL;this._contentType=contentType;}
8125 WebInspector.CompilerSourceMappingContentProvider.prototype={contentURL:function()
8126 {return this._sourceURL;},contentType:function()
8127 {return this._contentType;},requestContent:function(callback)
8128 {NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,this._sourceURL,undefined,contentLoaded.bind(this));function contentLoaded(error,statusCode,headers,content)
8129 {if(error||statusCode>=400){console.error("Could not load content for "+this._sourceURL+" : "+(error||("HTTP status code: "+statusCode)));callback(null);return;}
8130 callback(content);}},searchInContent:function(query,caseSensitive,isRegex,callback)
8131 {this.requestContent(contentLoaded);function contentLoaded(content)
8132 {if(typeof content!=="string"){callback([]);return;}
8133 callback(WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex));}}}
8134 WebInspector.StaticContentProvider=function(contentType,content)
8135 {this._content=content;this._contentType=contentType;}
8136 WebInspector.StaticContentProvider.prototype={contentURL:function()
8137 {return"";},contentType:function()
8138 {return this._contentType;},requestContent:function(callback)
8139 {callback(this._content);},searchInContent:function(query,caseSensitive,isRegex,callback)
8140 {function performSearch()
8141 {callback(WebInspector.ContentProvider.performSearchInContent(this._content,query,caseSensitive,isRegex));}
8142 window.setTimeout(performSearch.bind(this),0);}}
8143 WebInspector.DefaultScriptMapping=function(workspace)
8144 {this._projectDelegate=new WebInspector.DebuggerProjectDelegate();this._workspace=workspace;this._workspace.addProject(this._projectDelegate);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);this._debuggerReset();}
8145 WebInspector.DefaultScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
8146 {var debuggerModelLocation=(rawLocation);var script=WebInspector.debuggerModel.scriptForId(debuggerModelLocation.scriptId);var uiSourceCode=this._uiSourceCodeForScriptId[script.scriptId];var lineNumber=debuggerModelLocation.lineNumber;var columnNumber=debuggerModelLocation.columnNumber||0;return new WebInspector.UILocation(uiSourceCode,lineNumber,columnNumber);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
8147 {var scriptId=this._scriptIdForUISourceCode.get(uiSourceCode);var script=WebInspector.debuggerModel.scriptForId(scriptId);return WebInspector.debuggerModel.createRawLocation(script,lineNumber,columnNumber);},addScript:function(script)
8148 {var path=this._projectDelegate.addScript(script);var uiSourceCode=this._workspace.uiSourceCode(this._projectDelegate.id(),path);if(!uiSourceCode){console.assert(uiSourceCode);return;}
8149 this._uiSourceCodeForScriptId[script.scriptId]=uiSourceCode;this._scriptIdForUISourceCode.put(uiSourceCode,script.scriptId);uiSourceCode.setSourceMapping(this);script.pushSourceMapping(this);script.addEventListener(WebInspector.Script.Events.ScriptEdited,this._scriptEdited.bind(this,script.scriptId));},_scriptEdited:function(scriptId,event)
8150 {var content=(event.data);this._uiSourceCodeForScriptId[scriptId].addRevision(content);},_debuggerReset:function()
8151 {this._uiSourceCodeForScriptId={};this._scriptIdForUISourceCode=new Map();this._projectDelegate.reset();}}
8152 WebInspector.DebuggerProjectDelegate=function()
8153 {WebInspector.ContentProviderBasedProjectDelegate.call(this,WebInspector.projectTypes.Debugger);}
8154 WebInspector.DebuggerProjectDelegate.prototype={id:function()
8155 {return"debugger:";},displayName:function()
8156 {return"debugger";},addScript:function(script)
8157 {var contentProvider=script.isInlineScript()?new WebInspector.ConcatenatedScriptsContentProvider([script]):script;var splitURL=WebInspector.ParsedURL.splitURL(script.sourceURL);var name=splitURL[splitURL.length-1];name="VM"+script.scriptId+(name?" "+name:"");return this.addContentProvider("",name,script.sourceURL,contentProvider,false,script.isContentScript);},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
8158 WebInspector.ResourceScriptMapping=function(workspace)
8159 {this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);this._initialize();}
8160 WebInspector.ResourceScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
8161 {var debuggerModelLocation=(rawLocation);var script=WebInspector.debuggerModel.scriptForId(debuggerModelLocation.scriptId);var uiSourceCode=this._workspaceUISourceCodeForScript(script);if(!uiSourceCode)
8162 return null;var scriptFile=uiSourceCode.scriptFile();if(scriptFile&&((scriptFile.hasDivergedFromVM()&&!scriptFile.isMergingToVM())||scriptFile.isDivergingFromVM()))
8163 return null;return new WebInspector.UILocation(uiSourceCode,debuggerModelLocation.lineNumber,debuggerModelLocation.columnNumber||0);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
8164 {var scripts=this._scriptsForUISourceCode(uiSourceCode);console.assert(scripts.length);return WebInspector.debuggerModel.createRawLocation(scripts[0],lineNumber,columnNumber);},addScript:function(script)
8165 {if(script.isAnonymousScript())
8166 return;script.pushSourceMapping(this);var scriptsForSourceURL=script.isInlineScript()?this._inlineScriptsForSourceURL:this._nonInlineScriptsForSourceURL;scriptsForSourceURL.put(script.sourceURL,scriptsForSourceURL.get(script.sourceURL)||[]);scriptsForSourceURL.get(script.sourceURL).push(script);var uiSourceCode=this._workspaceUISourceCodeForScript(script);if(!uiSourceCode)
8167 return;this._bindUISourceCodeToScripts(uiSourceCode,[script]);},_uiSourceCodeAddedToWorkspace:function(event)
8168 {var uiSourceCode=(event.data);if(!uiSourceCode.url)
8169 return;var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
8170 return;this._bindUISourceCodeToScripts(uiSourceCode,scripts);},_hasMergedToVM:function(uiSourceCode)
8171 {var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
8172 return;for(var i=0;i<scripts.length;++i)
8173 scripts[i].updateLocations();},_hasDivergedFromVM:function(uiSourceCode)
8174 {var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
8175 return;for(var i=0;i<scripts.length;++i)
8176 scripts[i].updateLocations();},_workspaceUISourceCodeForScript:function(script)
8177 {if(script.isAnonymousScript())
8178 return null;return this._workspace.uiSourceCodeForURL(script.sourceURL);},_scriptsForUISourceCode:function(uiSourceCode)
8179 {var isInlineScript;switch(uiSourceCode.contentType()){case WebInspector.resourceTypes.Document:isInlineScript=true;break;case WebInspector.resourceTypes.Script:isInlineScript=false;break;default:return[];}
8180 if(!uiSourceCode.url)
8181 return[];var scriptsForSourceURL=isInlineScript?this._inlineScriptsForSourceURL:this._nonInlineScriptsForSourceURL;return scriptsForSourceURL.get(uiSourceCode.url)||[];},_bindUISourceCodeToScripts:function(uiSourceCode,scripts)
8182 {console.assert(scripts.length);var scriptFile=new WebInspector.ResourceScriptFile(this,uiSourceCode,scripts);uiSourceCode.setScriptFile(scriptFile);for(var i=0;i<scripts.length;++i)
8183 scripts[i].updateLocations();uiSourceCode.setSourceMapping(this);},_unbindUISourceCodeFromScripts:function(uiSourceCode,scripts)
8184 {console.assert(scripts.length);var scriptFile=(uiSourceCode.scriptFile());if(scriptFile){scriptFile.dispose();uiSourceCode.setScriptFile(null);}
8185 uiSourceCode.setSourceMapping(null);},_initialize:function()
8186 {this._inlineScriptsForSourceURL=new StringMap();this._nonInlineScriptsForSourceURL=new StringMap();},_debuggerReset:function()
8187 {function unbindUISourceCodesForScripts(scripts)
8188 {if(!scripts.length)
8189 return;var uiSourceCode=this._workspaceUISourceCodeForScript(scripts[0]);if(!uiSourceCode)
8190 return;this._unbindUISourceCodeFromScripts(uiSourceCode,scripts);}
8191 this._inlineScriptsForSourceURL.values().forEach(unbindUISourceCodesForScripts.bind(this));this._nonInlineScriptsForSourceURL.values().forEach(unbindUISourceCodesForScripts.bind(this));this._initialize();},}
8192 WebInspector.ScriptFile=function()
8193 {}
8194 WebInspector.ScriptFile.Events={DidMergeToVM:"DidMergeToVM",DidDivergeFromVM:"DidDivergeFromVM",}
8195 WebInspector.ScriptFile.prototype={hasDivergedFromVM:function(){return false;},isDivergingFromVM:function(){return false;},isMergingToVM:function(){return false;},checkMapping:function(){},}
8196 WebInspector.ResourceScriptFile=function(resourceScriptMapping,uiSourceCode,scripts)
8197 {console.assert(scripts.length);WebInspector.ScriptFile.call(this);this._resourceScriptMapping=resourceScriptMapping;this._uiSourceCode=uiSourceCode;if(this._uiSourceCode.contentType()===WebInspector.resourceTypes.Script)
8198 this._script=scripts[0];this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._update();}
8199 WebInspector.ResourceScriptFile.prototype={_workingCopyCommitted:function(event)
8200 {function innerCallback(error,errorData)
8201 {if(error){this._update();WebInspector.LiveEditSupport.logDetailedError(error,errorData,this._script);return;}
8202 this._scriptSource=source;this._update();WebInspector.LiveEditSupport.logSuccess();}
8203 if(!this._script)
8204 return;var source=this._uiSourceCode.workingCopy();WebInspector.debuggerModel.setScriptSource(this._script.scriptId,source,innerCallback.bind(this));},_isDiverged:function()
8205 {if(this._uiSourceCode.formatted())
8206 return false;if(this._uiSourceCode.isDirty())
8207 return true;if(!this._script)
8208 return false;if(typeof this._scriptSource==="undefined")
8209 return false;return this._uiSourceCode.workingCopy()!==this._scriptSource;},_workingCopyChanged:function(event)
8210 {this._update();},_update:function()
8211 {if(this._isDiverged()&&!this._hasDivergedFromVM)
8212 this._divergeFromVM();else if(!this._isDiverged()&&this._hasDivergedFromVM)
8213 this._mergeToVM();},_divergeFromVM:function()
8214 {this._isDivergingFromVM=true;this._resourceScriptMapping._hasDivergedFromVM(this._uiSourceCode);delete this._isDivergingFromVM;this._hasDivergedFromVM=true;this.dispatchEventToListeners(WebInspector.ScriptFile.Events.DidDivergeFromVM,this._uiSourceCode);},_mergeToVM:function()
8215 {delete this._hasDivergedFromVM;this._isMergingToVM=true;this._resourceScriptMapping._hasMergedToVM(this._uiSourceCode);delete this._isMergingToVM;this.dispatchEventToListeners(WebInspector.ScriptFile.Events.DidMergeToVM,this._uiSourceCode);},hasDivergedFromVM:function()
8216 {return this._hasDivergedFromVM;},isDivergingFromVM:function()
8217 {return this._isDivergingFromVM;},isMergingToVM:function()
8218 {return this._isMergingToVM;},checkMapping:function()
8219 {if(!this._script)
8220 return;if(typeof this._scriptSource!=="undefined")
8221 return;this._script.requestContent(callback.bind(this));function callback(source)
8222 {this._scriptSource=source;this._update();}},dispose:function()
8223 {this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);},__proto__:WebInspector.Object.prototype}
8224 WebInspector.CompilerScriptMapping=function(workspace,networkWorkspaceProvider)
8225 {this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);this._networkWorkspaceProvider=networkWorkspaceProvider;this._sourceMapForSourceMapURL={};this._pendingSourceMapLoadingCallbacks={};this._sourceMapForScriptId={};this._scriptForSourceMap=new Map();this._sourceMapForURL=new StringMap();WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
8226 WebInspector.CompilerScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
8227 {var debuggerModelLocation=(rawLocation);var sourceMap=this._sourceMapForScriptId[debuggerModelLocation.scriptId];if(!sourceMap)
8228 return null;var lineNumber=debuggerModelLocation.lineNumber;var columnNumber=debuggerModelLocation.columnNumber||0;var entry=sourceMap.findEntry(lineNumber,columnNumber);if(!entry||entry.length===2)
8229 return null;var url=(entry[2]);var uiSourceCode=this._workspace.uiSourceCodeForURL(url);if(!uiSourceCode)
8230 return null;return new WebInspector.UILocation(uiSourceCode,(entry[3]),(entry[4]));},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
8231 {if(!uiSourceCode.url)
8232 return null;var sourceMap=this._sourceMapForURL.get(uiSourceCode.url);if(!sourceMap)
8233 return null;var script=(this._scriptForSourceMap.get(sourceMap));console.assert(script);var entry=sourceMap.findEntryReversed(uiSourceCode.url,lineNumber);return WebInspector.debuggerModel.createRawLocation(script,(entry[0]),(entry[1]));},addScript:function(script)
8234 {script.pushSourceMapping(this);this.loadSourceMapForScript(script,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
8235 {if(!sourceMap)
8236 return;if(this._scriptForSourceMap.get(sourceMap)){this._sourceMapForScriptId[script.scriptId]=sourceMap;script.updateLocations();return;}
8237 this._sourceMapForScriptId[script.scriptId]=sourceMap;this._scriptForSourceMap.put(sourceMap,script);var sourceURLs=sourceMap.sources();for(var i=0;i<sourceURLs.length;++i){var sourceURL=sourceURLs[i];if(this._sourceMapForURL.get(sourceURL))
8238 continue;this._sourceMapForURL.put(sourceURL,sourceMap);if(!this._workspace.hasMappingForURL(sourceURL)&&!this._workspace.uiSourceCodeForURL(sourceURL)){var contentProvider=sourceMap.sourceContentProvider(sourceURL,WebInspector.resourceTypes.Script);this._networkWorkspaceProvider.addFileForURL(sourceURL,contentProvider,true);}
8239 var uiSourceCode=this._workspace.uiSourceCodeForURL(sourceURL);if(uiSourceCode){this._bindUISourceCode(uiSourceCode);uiSourceCode.isContentScript=script.isContentScript;}else{WebInspector.showErrorMessage(WebInspector.UIString("Failed to locate workspace file mapped to URL %s from source map %s",sourceURL,sourceMap.url()));}}
8240 script.updateLocations();}},_bindUISourceCode:function(uiSourceCode)
8241 {uiSourceCode.setSourceMapping(this);},_unbindUISourceCode:function(uiSourceCode)
8242 {uiSourceCode.setSourceMapping(null);},_uiSourceCodeAddedToWorkspace:function(event)
8243 {var uiSourceCode=(event.data);if(!uiSourceCode.url||!this._sourceMapForURL.get(uiSourceCode.url))
8244 return;this._bindUISourceCode(uiSourceCode);},loadSourceMapForScript:function(script,callback)
8245 {if(!script.sourceMapURL){callback(null);return;}
8246 var scriptURL=WebInspector.ParsedURL.completeURL(WebInspector.inspectedPageURL,script.sourceURL);if(!scriptURL){callback(null);return;}
8247 var sourceMapURL=WebInspector.ParsedURL.completeURL(scriptURL,script.sourceMapURL);if(!sourceMapURL){callback(null);return;}
8248 var sourceMap=this._sourceMapForSourceMapURL[sourceMapURL];if(sourceMap){callback(sourceMap);return;}
8249 var pendingCallbacks=this._pendingSourceMapLoadingCallbacks[sourceMapURL];if(pendingCallbacks){pendingCallbacks.push(callback);return;}
8250 pendingCallbacks=[callback];this._pendingSourceMapLoadingCallbacks[sourceMapURL]=pendingCallbacks;WebInspector.SourceMap.load(sourceMapURL,scriptURL,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
8251 {var url=(sourceMapURL);var callbacks=this._pendingSourceMapLoadingCallbacks[url];delete this._pendingSourceMapLoadingCallbacks[url];if(!callbacks)
8252 return;if(sourceMap)
8253 this._sourceMapForSourceMapURL[url]=sourceMap;for(var i=0;i<callbacks.length;++i)
8254 callbacks[i](sourceMap);}},_debuggerReset:function()
8255 {function unbindUISourceCodesForSourceMap(sourceMap)
8256 {var sourceURLs=sourceMap.sources();for(var i=0;i<sourceURLs.length;++i){var sourceURL=sourceURLs[i];var uiSourceCode=this._workspace.uiSourceCodeForURL(sourceURL);if(!uiSourceCode)
8257 continue;this._unbindUISourceCode(uiSourceCode);}}
8258 this._sourceMapForURL.values().forEach(unbindUISourceCodesForSourceMap.bind(this));this._sourceMapForSourceMapURL={};this._pendingSourceMapLoadingCallbacks={};this._sourceMapForScriptId={};this._scriptForSourceMap.clear();this._sourceMapForURL.clear();}}
8259 WebInspector.LiveEditSupport=function(workspace)
8260 {this._workspaceProvider=new WebInspector.SimpleWorkspaceProvider(workspace,WebInspector.projectTypes.LiveEdit);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);this._debuggerReset();}
8261 WebInspector.LiveEditSupport.prototype={uiSourceCodeForLiveEdit:function(uiSourceCode)
8262 {var rawLocation=uiSourceCode.uiLocationToRawLocation(0,0);var debuggerModelLocation=(rawLocation);var script=WebInspector.debuggerModel.scriptForId(debuggerModelLocation.scriptId);var uiLocation=script.rawLocationToUILocation(0,0);if(uiLocation.uiSourceCode!==uiSourceCode)
8263 return uiLocation.uiSourceCode;if(this._uiSourceCodeForScriptId[script.scriptId])
8264 return this._uiSourceCodeForScriptId[script.scriptId];console.assert(!script.isInlineScript());var liveEditUISourceCode=this._workspaceProvider.addUniqueFileForURL(script.sourceURL,script,true,script.isContentScript);liveEditUISourceCode.setScriptFile(new WebInspector.LiveEditScriptFile(uiSourceCode,liveEditUISourceCode,script.scriptId));this._uiSourceCodeForScriptId[script.scriptId]=liveEditUISourceCode;this._scriptIdForUISourceCode.put(liveEditUISourceCode,script.scriptId);return liveEditUISourceCode;},_debuggerReset:function()
8265 {this._uiSourceCodeForScriptId={};this._scriptIdForUISourceCode=new Map();this._workspaceProvider.reset();},}
8266 WebInspector.LiveEditSupport.logDetailedError=function(error,errorData,contextScript)
8267 {var warningLevel=WebInspector.ConsoleMessage.MessageLevel.Warning;if(!errorData){if(error)
8268 WebInspector.log(WebInspector.UIString("LiveEdit failed: %s",error),warningLevel,false);return;}
8269 var compileError=errorData.compileError;if(compileError){var location=contextScript?WebInspector.UIString(" at %s:%d:%d",contextScript.sourceURL,compileError.lineNumber,compileError.columnNumber):"";var message=WebInspector.UIString("LiveEdit compile failed: %s%s",compileError.message,location);WebInspector.log(message,WebInspector.ConsoleMessage.MessageLevel.Error,false);}else{WebInspector.log(WebInspector.UIString("Unknown LiveEdit error: %s; %s",JSON.stringify(errorData),error),warningLevel,false);}}
8270 WebInspector.LiveEditSupport.logSuccess=function()
8271 {WebInspector.log(WebInspector.UIString("Recompilation and update succeeded."),WebInspector.ConsoleMessage.MessageLevel.Debug,false);}
8272 WebInspector.LiveEditScriptFile=function(uiSourceCode,liveEditUISourceCode,scriptId)
8273 {WebInspector.ScriptFile.call(this);this._uiSourceCode=uiSourceCode;this._liveEditUISourceCode=liveEditUISourceCode;this._scriptId=scriptId;this._liveEditUISourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);}
8274 WebInspector.LiveEditScriptFile.prototype={_workingCopyCommitted:function(event)
8275 {function innerCallback(error,errorData)
8276 {if(error){var script=WebInspector.debuggerModel.scriptForId(this._scriptId);WebInspector.LiveEditSupport.logDetailedError(error,errorData,script);return;}
8277 WebInspector.LiveEditSupport.logSuccess();}
8278 var script=WebInspector.debuggerModel.scriptForId(this._scriptId);WebInspector.debuggerModel.setScriptSource(script.scriptId,this._liveEditUISourceCode.workingCopy(),innerCallback.bind(this));},hasDivergedFromVM:function()
8279 {return true;},isDivergingFromVM:function()
8280 {return false;},isMergingToVM:function()
8281 {return false;},checkMapping:function()
8282 {},__proto__:WebInspector.Object.prototype}
8283 WebInspector.liveEditSupport;WebInspector.CSSStyleSheetMapping=function(cssModel,workspace,networkWorkspaceProvider)
8284 {this._cssModel=cssModel;this._workspace=workspace;this._stylesSourceMapping=new WebInspector.StylesSourceMapping(cssModel,workspace);this._sassSourceMapping=new WebInspector.SASSSourceMapping(cssModel,workspace,networkWorkspaceProvider);cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);}
8285 WebInspector.CSSStyleSheetMapping.prototype={_styleSheetAdded:function(event)
8286 {var header=(event.data);this._stylesSourceMapping.addHeader(header);this._sassSourceMapping.addHeader(header);},_styleSheetRemoved:function(event)
8287 {var header=(event.data);this._stylesSourceMapping.removeHeader(header);this._sassSourceMapping.removeHeader(header);}}
8288 WebInspector.SASSSourceMapping=function(cssModel,workspace,networkWorkspaceProvider)
8289 {this.pollPeriodMs=5000;this.pollIntervalMs=200;this._cssModel=cssModel;this._workspace=workspace;this._networkWorkspaceProvider=networkWorkspaceProvider;this._addingRevisionCounter=0;this._reset();WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.SavedURL,this._fileSaveFinished,this);WebInspector.settings.cssSourceMapsEnabled.addChangeListener(this._toggleSourceMapSupport,this)
8290 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged,this._styleSheetChanged,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted,this._uiSourceCodeContentCommitted,this);this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset,this._reset,this);}
8291 WebInspector.SASSSourceMapping.prototype={_styleSheetChanged:function(event)
8292 {var id=(event.data.styleSheetId);if(this._addingRevisionCounter){--this._addingRevisionCounter;return;}
8293 var header=this._cssModel.styleSheetHeaderForId(id);if(!header)
8294 return;this.removeHeader(header);},_toggleSourceMapSupport:function(event)
8295 {var enabled=(event.data);var headers=this._cssModel.styleSheetHeaders();for(var i=0;i<headers.length;++i){if(enabled)
8296 this.addHeader(headers[i]);else
8297 this.removeHeader(headers[i]);}},_fileSaveFinished:function(event)
8298 {var sassURL=(event.data);this._sassFileSaved(sassURL,false);},_headerValue:function(headerName,headers)
8299 {headerName=headerName.toLowerCase();var value=null;for(var name in headers){if(name.toLowerCase()===headerName){value=headers[name];break;}}
8300 return value;},_lastModified:function(headers)
8301 {var lastModifiedHeader=this._headerValue("last-modified",headers);if(!lastModifiedHeader)
8302 return null;var lastModified=new Date(lastModifiedHeader);if(isNaN(lastModified.getTime()))
8303 return null;return lastModified;},_checkLastModified:function(headers,url)
8304 {var lastModified=this._lastModified(headers);if(lastModified)
8305 return lastModified;var etagMessage=this._headerValue("etag",headers)?", \"ETag\" response header found instead":"";var message=String.sprintf("The \"Last-Modified\" response header is missing or invalid for %s%s. The CSS auto-reload functionality will not work correctly.",url,etagMessage);WebInspector.log(message);return null;},_sassFileSaved:function(sassURL,wasLoadedFromFileSystem)
8306 {var cssURLs=this._cssURLsForSASSURL[sassURL];if(!cssURLs)
8307 return;if(!WebInspector.settings.cssReloadEnabled.get())
8308 return;var sassFile=this._workspace.uiSourceCodeForURL(sassURL);console.assert(sassFile);if(wasLoadedFromFileSystem)
8309 sassFile.requestMetadata(metadataReceived.bind(this));else
8310 NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,sassURL,undefined,sassLoadedViaNetwork.bind(this));function sassLoadedViaNetwork(error,statusCode,headers,content)
8311 {if(error||statusCode>=400){console.error("Could not load content for "+sassURL+" : "+(error||("HTTP status code: "+statusCode)));return;}
8312 var lastModified=this._checkLastModified(headers,sassURL);if(!lastModified)
8313 return;metadataReceived.call(this,lastModified);}
8314 function metadataReceived(timestamp)
8315 {if(!timestamp)
8316 return;var now=Date.now();var deadlineMs=now+this.pollPeriodMs;var pollData=this._pollDataForSASSURL[sassURL];if(pollData){var dataByURL=pollData.dataByURL;for(var url in dataByURL)
8317 clearTimeout(dataByURL[url].timer);}
8318 pollData={dataByURL:{},deadlineMs:deadlineMs,sassTimestamp:timestamp};this._pollDataForSASSURL[sassURL]=pollData;for(var i=0;i<cssURLs.length;++i){pollData.dataByURL[cssURLs[i]]={previousPoll:now};this._pollCallback(cssURLs[i],sassURL,false);}}},_pollCallback:function(cssURL,sassURL,stopPolling)
8319 {var now;var pollData=this._pollDataForSASSURL[sassURL];if(!pollData)
8320 return;if(stopPolling||(now=new Date().getTime())>pollData.deadlineMs){delete pollData.dataByURL[cssURL];if(!Object.keys(pollData.dataByURL).length)
8321 delete this._pollDataForSASSURL[sassURL];return;}
8322 var nextPoll=this.pollIntervalMs+pollData.dataByURL[cssURL].previousPoll;var remainingTimeoutMs=Math.max(0,nextPoll-now);pollData.dataByURL[cssURL].previousPoll=now+remainingTimeoutMs;pollData.dataByURL[cssURL].timer=setTimeout(this._reloadCSS.bind(this,cssURL,sassURL,this._pollCallback.bind(this)),remainingTimeoutMs);},_reloadCSS:function(cssURL,sassURL,callback)
8323 {var cssUISourceCode=this._workspace.uiSourceCodeForURL(cssURL);if(!cssUISourceCode){WebInspector.log(WebInspector.UIString("%s resource missing. Please reload the page.",cssURL));callback(cssURL,sassURL,true);return;}
8324 if(this._workspace.hasMappingForURL(sassURL))
8325 this._reloadCSSFromFileSystem(cssUISourceCode,sassURL,callback);else
8326 this._reloadCSSFromNetwork(cssUISourceCode,sassURL,callback);},_reloadCSSFromNetwork:function(cssUISourceCode,sassURL,callback)
8327 {var cssURL=cssUISourceCode.url;var data=this._pollDataForSASSURL[sassURL];if(!data){callback(cssURL,sassURL,true);return;}
8328 var headers={"if-modified-since":new Date(data.sassTimestamp.getTime()-1000).toUTCString()};NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,cssURL,headers,contentLoaded.bind(this));function contentLoaded(error,statusCode,headers,content)
8329 {if(error||statusCode>=400){console.error("Could not load content for "+cssURL+" : "+(error||("HTTP status code: "+statusCode)));callback(cssURL,sassURL,true);return;}
8330 if(!this._pollDataForSASSURL[sassURL]){callback(cssURL,sassURL,true);return;}
8331 if(statusCode===304){callback(cssURL,sassURL,false);return;}
8332 var lastModified=this._checkLastModified(headers,cssURL);if(!lastModified){callback(cssURL,sassURL,true);return;}
8333 if(lastModified.getTime()<data.sassTimestamp.getTime()){callback(cssURL,sassURL,false);return;}
8334 this._updateCSSRevision(cssUISourceCode,content,sassURL,callback);}},_updateCSSRevision:function(cssUISourceCode,content,sassURL,callback)
8335 {++this._addingRevisionCounter;cssUISourceCode.addRevision(content);this._cssUISourceCodeUpdated(cssUISourceCode.url,sassURL,callback);},_reloadCSSFromFileSystem:function(cssUISourceCode,sassURL,callback)
8336 {cssUISourceCode.requestMetadata(metadataCallback.bind(this));function metadataCallback(timestamp)
8337 {var cssURL=cssUISourceCode.url;if(!timestamp){callback(cssURL,sassURL,false);return;}
8338 var cssTimestamp=timestamp.getTime();var pollData=this._pollDataForSASSURL[sassURL];if(!pollData){callback(cssURL,sassURL,true);return;}
8339 if(cssTimestamp<pollData.sassTimestamp.getTime()){callback(cssURL,sassURL,false);return;}
8340 cssUISourceCode.requestOriginalContent(contentCallback.bind(this));function contentCallback(content)
8341 {if(content===null)
8342 return;this._updateCSSRevision(cssUISourceCode,content,sassURL,callback);}}},_cssUISourceCodeUpdated:function(cssURL,sassURL,callback)
8343 {var completeSourceMapURL=this._completeSourceMapURLForCSSURL[cssURL];if(!completeSourceMapURL)
8344 return;var ids=this._cssModel.styleSheetIdsForURL(cssURL);if(!ids)
8345 return;var headers=[];for(var i=0;i<ids.length;++i)
8346 headers.push(this._cssModel.styleSheetHeaderForId(ids[i]));for(var i=0;i<ids.length;++i)
8347 this._loadSourceMapAndBindUISourceCode(headers,true,completeSourceMapURL);callback(cssURL,sassURL,true);},addHeader:function(header)
8348 {if(!header.sourceMapURL||!header.sourceURL||header.isInline||!WebInspector.settings.cssSourceMapsEnabled.get())
8349 return;var completeSourceMapURL=WebInspector.ParsedURL.completeURL(header.sourceURL,header.sourceMapURL);if(!completeSourceMapURL)
8350 return;this._completeSourceMapURLForCSSURL[header.sourceURL]=completeSourceMapURL;this._loadSourceMapAndBindUISourceCode([header],false,completeSourceMapURL);},removeHeader:function(header)
8351 {var sourceURL=header.sourceURL;if(!sourceURL||!header.sourceMapURL||header.isInline||!this._completeSourceMapURLForCSSURL[sourceURL])
8352 return;delete this._sourceMapByStyleSheetURL[sourceURL];delete this._completeSourceMapURLForCSSURL[sourceURL];for(var sassURL in this._cssURLsForSASSURL){var urls=this._cssURLsForSASSURL[sassURL];urls.remove(sourceURL);if(!urls.length)
8353 delete this._cssURLsForSASSURL[sassURL];}
8354 var completeSourceMapURL=WebInspector.ParsedURL.completeURL(sourceURL,header.sourceMapURL);if(completeSourceMapURL)
8355 delete this._sourceMapByURL[completeSourceMapURL];header.updateLocations();},_loadSourceMapAndBindUISourceCode:function(headersWithSameSourceURL,forceRebind,completeSourceMapURL)
8356 {console.assert(headersWithSameSourceURL.length);var sourceURL=headersWithSameSourceURL[0].sourceURL;this._loadSourceMapForStyleSheet(completeSourceMapURL,sourceURL,forceRebind,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
8357 {if(!sourceMap)
8358 return;this._sourceMapByStyleSheetURL[sourceURL]=sourceMap;for(var i=0;i<headersWithSameSourceURL.length;++i){if(forceRebind)
8359 headersWithSameSourceURL[i].updateLocations();else
8360 this._bindUISourceCode(headersWithSameSourceURL[i],sourceMap);}}},_addCSSURLforSASSURL:function(cssURL,sassURL)
8361 {var cssURLs;if(this._cssURLsForSASSURL.hasOwnProperty(sassURL))
8362 cssURLs=this._cssURLsForSASSURL[sassURL];else{cssURLs=[];this._cssURLsForSASSURL[sassURL]=cssURLs;}
8363 if(cssURLs.indexOf(cssURL)===-1)
8364 cssURLs.push(cssURL);},_loadSourceMapForStyleSheet:function(completeSourceMapURL,completeStyleSheetURL,forceReload,callback)
8365 {var sourceMap=this._sourceMapByURL[completeSourceMapURL];if(sourceMap&&!forceReload){callback(sourceMap);return;}
8366 var pendingCallbacks=this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];if(pendingCallbacks){pendingCallbacks.push(callback);return;}
8367 pendingCallbacks=[callback];this._pendingSourceMapLoadingCallbacks[completeSourceMapURL]=pendingCallbacks;WebInspector.SourceMap.load(completeSourceMapURL,completeStyleSheetURL,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
8368 {var callbacks=this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];delete this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];if(!callbacks)
8369 return;if(sourceMap)
8370 this._sourceMapByURL[completeSourceMapURL]=sourceMap;else
8371 delete this._sourceMapByURL[completeSourceMapURL];for(var i=0;i<callbacks.length;++i)
8372 callbacks[i](sourceMap);}},_bindUISourceCode:function(header,sourceMap)
8373 {header.pushSourceMapping(this);var rawURL=header.sourceURL;var sources=sourceMap.sources();for(var i=0;i<sources.length;++i){var url=sources[i];this._addCSSURLforSASSURL(rawURL,url);if(!this._workspace.hasMappingForURL(url)&&!this._workspace.uiSourceCodeForURL(url)){var contentProvider=sourceMap.sourceContentProvider(url,WebInspector.resourceTypes.Stylesheet);this._networkWorkspaceProvider.addFileForURL(url,contentProvider,true);}}},rawLocationToUILocation:function(rawLocation)
8374 {var location=(rawLocation);var entry;var sourceMap=this._sourceMapByStyleSheetURL[location.url];if(!sourceMap)
8375 return null;entry=sourceMap.findEntry(location.lineNumber,location.columnNumber);if(!entry||entry.length===2)
8376 return null;var uiSourceCode=this._workspace.uiSourceCodeForURL(entry[2]);if(!uiSourceCode)
8377 return null;return new WebInspector.UILocation(uiSourceCode,entry[3],entry[4]);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
8378 {return new WebInspector.CSSLocation(uiSourceCode.url||"",lineNumber,columnNumber);},_uiSourceCodeAdded:function(event)
8379 {var uiSourceCode=(event.data);var cssURLs=this._cssURLsForSASSURL[uiSourceCode.url];if(!cssURLs)
8380 return;for(var i=0;i<cssURLs.length;++i){var ids=this._cssModel.styleSheetIdsForURL(cssURLs[i]);for(var j=0;j<ids.length;++j){var header=this._cssModel.styleSheetHeaderForId(ids[j]);console.assert(header);header.updateLocations();}}},_uiSourceCodeContentCommitted:function(event)
8381 {var uiSourceCode=(event.data.uiSourceCode);if(uiSourceCode.project().type()===WebInspector.projectTypes.FileSystem)
8382 this._sassFileSaved(uiSourceCode.url,true);},_reset:function()
8383 {this._addingRevisionCounter=0;this._completeSourceMapURLForCSSURL={};this._cssURLsForSASSURL={};this._pendingSourceMapLoadingCallbacks={};this._pollDataForSASSURL={};this._sourceMapByURL={};this._sourceMapByStyleSheetURL={};}}
8384 WebInspector.DOMNode=function(domAgent,doc,isInShadowTree,payload){this._domAgent=domAgent;this.ownerDocument=doc;this._isInShadowTree=isInShadowTree;this.id=payload.nodeId;domAgent._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._shadowRoots=[];this._attributes=[];this._attributesMap={};if(payload.attributes)
8385 this._setAttributesPayload(payload.attributes);this._userProperties={};this._descendantUserPropertyCounters={};this._childNodeCount=payload.childNodeCount||0;this._children=null;this.nextSibling=null;this.previousSibling=null;this.firstChild=null;this.lastChild=null;this.parentNode=null;if(payload.shadowRoots){for(var i=0;i<payload.shadowRoots.length;++i){var root=payload.shadowRoots[i];var node=new WebInspector.DOMNode(this._domAgent,this.ownerDocument,true,root);this._shadowRoots.push(node);node.parentNode=this;}}
8386 if(payload.templateContent){this._templateContent=new WebInspector.DOMNode(this._domAgent,this.ownerDocument,true,payload.templateContent);this._templateContent.parentNode=this;}
8387 if(payload.children)
8388 this._setChildrenPayload(payload.children);this._setPseudoElements(payload.pseudoElements);if(payload.contentDocument){this._contentDocument=new WebInspector.DOMDocument(domAgent,payload.contentDocument);this._children=[this._contentDocument];this._renumber();}
8389 if(this._nodeType===Node.ELEMENT_NODE){if(this.ownerDocument&&!this.ownerDocument.documentElement&&this._nodeName==="HTML")
8390 this.ownerDocument.documentElement=this;if(this.ownerDocument&&!this.ownerDocument.body&&this._nodeName==="BODY")
8391 this.ownerDocument.body=this;}else if(this._nodeType===Node.DOCUMENT_TYPE_NODE){this.publicId=payload.publicId;this.systemId=payload.systemId;this.internalSubset=payload.internalSubset;}else if(this._nodeType===Node.ATTRIBUTE_NODE){this.name=payload.name;this.value=payload.value;}}
8392 WebInspector.DOMNode.PseudoElementNames={Before:"before",After:"after"}
8393 WebInspector.DOMNode.ShadowRootTypes={UserAgent:"user-agent",Author:"author"}
8394 WebInspector.DOMNode.prototype={children:function()
8395 {return this._children?this._children.slice():null;},hasAttributes:function()
8396 {return this._attributes.length>0;},childNodeCount:function()
8397 {return this._childNodeCount;},hasShadowRoots:function()
8398 {return!!this._shadowRoots.length;},shadowRoots:function()
8399 {return this._shadowRoots.slice();},templateContent:function()
8400 {return this._templateContent;},nodeType:function()
8401 {return this._nodeType;},nodeName:function()
8402 {return this._nodeName;},pseudoType:function()
8403 {return this._pseudoType;},hasPseudoElements:function()
8404 {return Object.keys(this._pseudoElements).length!==0;},pseudoElements:function()
8405 {return this._pseudoElements;},isInShadowTree:function()
8406 {return this._isInShadowTree;},shadowRootType:function()
8407 {return this._shadowRootType||null;},nodeNameInCorrectCase:function()
8408 {return this.isXMLNode()?this.nodeName():this.nodeName().toLowerCase();},setNodeName:function(name,callback)
8409 {DOMAgent.setNodeName(this.id,name,WebInspector.domAgent._markRevision(this,callback));},localName:function()
8410 {return this._localName;},nodeValue:function()
8411 {return this._nodeValue;},setNodeValue:function(value,callback)
8412 {DOMAgent.setNodeValue(this.id,value,WebInspector.domAgent._markRevision(this,callback));},getAttribute:function(name)
8413 {var attr=this._attributesMap[name];return attr?attr.value:undefined;},setAttribute:function(name,text,callback)
8414 {DOMAgent.setAttributesAsText(this.id,text,name,WebInspector.domAgent._markRevision(this,callback));},setAttributeValue:function(name,value,callback)
8415 {DOMAgent.setAttributeValue(this.id,name,value,WebInspector.domAgent._markRevision(this,callback));},attributes:function()
8416 {return this._attributes;},removeAttribute:function(name,callback)
8417 {function mycallback(error)
8418 {if(!error){delete this._attributesMap[name];for(var i=0;i<this._attributes.length;++i){if(this._attributes[i].name===name){this._attributes.splice(i,1);break;}}}
8419 WebInspector.domAgent._markRevision(this,callback)(error);}
8420 DOMAgent.removeAttribute(this.id,name,mycallback.bind(this));},getChildNodes:function(callback)
8421 {if(this._children){if(callback)
8422 callback(this.children());return;}
8423 function mycallback(error)
8424 {if(callback)
8425 callback(error?null:this.children());}
8426 DOMAgent.requestChildNodes(this.id,undefined,mycallback.bind(this));},getSubtree:function(depth,callback)
8427 {function mycallback(error)
8428 {if(callback)
8429 callback(error?null:this._children);}
8430 DOMAgent.requestChildNodes(this.id,depth,mycallback.bind(this));},getOuterHTML:function(callback)
8431 {DOMAgent.getOuterHTML(this.id,callback);},setOuterHTML:function(html,callback)
8432 {DOMAgent.setOuterHTML(this.id,html,WebInspector.domAgent._markRevision(this,callback));},removeNode:function(callback)
8433 {DOMAgent.removeNode(this.id,WebInspector.domAgent._markRevision(this,callback));},copyNode:function()
8434 {function copy(error,text)
8435 {if(!error)
8436 InspectorFrontendHost.copyText(text);}
8437 DOMAgent.getOuterHTML(this.id,copy);},eventListeners:function(objectGroupId,callback)
8438 {DOMAgent.getEventListenersForNode(this.id,objectGroupId,callback);},path:function()
8439 {var path=[];var node=this;while(node&&"index"in node&&node._nodeName.length){path.push([node.index,node._nodeName]);node=node.parentNode;}
8440 path.reverse();return path.join(",");},isAncestor:function(node)
8441 {if(!node)
8442 return false;var currentNode=node.parentNode;while(currentNode){if(this===currentNode)
8443 return true;currentNode=currentNode.parentNode;}
8444 return false;},isDescendant:function(descendant)
8445 {return descendant!==null&&descendant.isAncestor(this);},_setAttributesPayload:function(attrs)
8446 {var attributesChanged=!this._attributes||attrs.length!==this._attributes.length*2;var oldAttributesMap=this._attributesMap||{};this._attributes=[];this._attributesMap={};for(var i=0;i<attrs.length;i+=2){var name=attrs[i];var value=attrs[i+1];this._addAttribute(name,value);if(attributesChanged)
8447 continue;if(!oldAttributesMap[name]||oldAttributesMap[name].value!==value)
8448 attributesChanged=true;}
8449 return attributesChanged;},_insertChild:function(prev,payload)
8450 {var node=new WebInspector.DOMNode(this._domAgent,this.ownerDocument,this._isInShadowTree,payload);this._children.splice(this._children.indexOf(prev)+1,0,node);this._renumber();return node;},_removeChild:function(node)
8451 {if(node.pseudoType()){delete this._pseudoElements[node.pseudoType()];}else{var shadowRootIndex=this._shadowRoots.indexOf(node);if(shadowRootIndex!==-1)
8452 this._shadowRoots.splice(shadowRootIndex,1);else
8453 this._children.splice(this._children.indexOf(node),1);}
8454 node.parentNode=null;node._updateChildUserPropertyCountsOnRemoval(this);this._renumber();},_setChildrenPayload:function(payloads)
8455 {if(this._contentDocument)
8456 return;this._children=[];for(var i=0;i<payloads.length;++i){var payload=payloads[i];var node=new WebInspector.DOMNode(this._domAgent,this.ownerDocument,this._isInShadowTree,payload);this._children.push(node);}
8457 this._renumber();},_setPseudoElements:function(payloads)
8458 {this._pseudoElements={};if(!payloads)
8459 return;for(var i=0;i<payloads.length;++i){var node=new WebInspector.DOMNode(this._domAgent,this.ownerDocument,this._isInShadowTree,payloads[i]);node.parentNode=this;this._pseudoElements[node.pseudoType()]=node;}},_renumber:function()
8460 {this._childNodeCount=this._children.length;if(this._childNodeCount==0){this.firstChild=null;this.lastChild=null;return;}
8461 this.firstChild=this._children[0];this.lastChild=this._children[this._childNodeCount-1];for(var i=0;i<this._childNodeCount;++i){var child=this._children[i];child.index=i;child.nextSibling=i+1<this._childNodeCount?this._children[i+1]:null;child.previousSibling=i-1>=0?this._children[i-1]:null;child.parentNode=this;}},_addAttribute:function(name,value)
8462 {var attr={name:name,value:value,_node:this};this._attributesMap[name]=attr;this._attributes.push(attr);},_setAttribute:function(name,value)
8463 {var attr=this._attributesMap[name];if(attr)
8464 attr.value=value;else
8465 this._addAttribute(name,value);},_removeAttribute:function(name)
8466 {var attr=this._attributesMap[name];if(attr){this._attributes.remove(attr);delete this._attributesMap[name];}},moveTo:function(targetNode,anchorNode,callback)
8467 {DOMAgent.moveTo(this.id,targetNode.id,anchorNode?anchorNode.id:undefined,WebInspector.domAgent._markRevision(this,callback));},isXMLNode:function()
8468 {return!!this.ownerDocument&&!!this.ownerDocument.xmlVersion;},_updateChildUserPropertyCountsOnRemoval:function(parentNode)
8469 {var result={};if(this._userProperties){for(var name in this._userProperties)
8470 result[name]=(result[name]||0)+1;}
8471 if(this._descendantUserPropertyCounters){for(var name in this._descendantUserPropertyCounters){var counter=this._descendantUserPropertyCounters[name];result[name]=(result[name]||0)+counter;}}
8472 for(var name in result)
8473 parentNode._updateDescendantUserPropertyCount(name,-result[name]);},_updateDescendantUserPropertyCount:function(name,delta)
8474 {if(!this._descendantUserPropertyCounters.hasOwnProperty(name))
8475 this._descendantUserPropertyCounters[name]=0;this._descendantUserPropertyCounters[name]+=delta;if(!this._descendantUserPropertyCounters[name])
8476 delete this._descendantUserPropertyCounters[name];if(this.parentNode)
8477 this.parentNode._updateDescendantUserPropertyCount(name,delta);},setUserProperty:function(name,value)
8478 {if(value===null){this.removeUserProperty(name);return;}
8479 if(this.parentNode&&!this._userProperties.hasOwnProperty(name))
8480 this.parentNode._updateDescendantUserPropertyCount(name,1);this._userProperties[name]=value;},removeUserProperty:function(name)
8481 {if(!this._userProperties.hasOwnProperty(name))
8482 return;delete this._userProperties[name];if(this.parentNode)
8483 this.parentNode._updateDescendantUserPropertyCount(name,-1);},getUserProperty:function(name)
8484 {return(this._userProperties&&this._userProperties[name])||null;},descendantUserPropertyCount:function(name)
8485 {return this._descendantUserPropertyCounters&&this._descendantUserPropertyCounters[name]?this._descendantUserPropertyCounters[name]:0;},resolveURL:function(url)
8486 {if(!url)
8487 return url;for(var frameOwnerCandidate=this;frameOwnerCandidate;frameOwnerCandidate=frameOwnerCandidate.parentNode){if(frameOwnerCandidate.baseURL)
8488 return WebInspector.ParsedURL.completeURL(frameOwnerCandidate.baseURL,url);}
8489 return null;}}
8490 WebInspector.DOMDocument=function(domAgent,payload)
8491 {WebInspector.DOMNode.call(this,domAgent,this,false,payload);this.documentURL=payload.documentURL||"";this.baseURL=payload.baseURL||"";this.xmlVersion=payload.xmlVersion;this._listeners={};}
8492 WebInspector.DOMDocument.prototype={__proto__:WebInspector.DOMNode.prototype}
8493 WebInspector.DOMAgent=function(){this._idToDOMNode={};this._document=null;this._attributeLoadNodeIds={};InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this));this._defaultHighlighter=new WebInspector.DefaultDOMNodeHighlighter();this._highlighter=this._defaultHighlighter;}
8494 WebInspector.DOMAgent.Events={AttrModified:"AttrModified",AttrRemoved:"AttrRemoved",CharacterDataModified:"CharacterDataModified",NodeInserted:"NodeInserted",NodeRemoved:"NodeRemoved",DocumentUpdated:"DocumentUpdated",ChildNodeCountUpdated:"ChildNodeCountUpdated",UndoRedoRequested:"UndoRedoRequested",UndoRedoCompleted:"UndoRedoCompleted",InspectNodeRequested:"InspectNodeRequested"}
8495 WebInspector.DOMAgent.prototype={requestDocument:function(callback)
8496 {if(this._document){if(callback)
8497 callback(this._document);return;}
8498 if(this._pendingDocumentRequestCallbacks){this._pendingDocumentRequestCallbacks.push(callback);return;}
8499 this._pendingDocumentRequestCallbacks=[callback];function onDocumentAvailable(error,root)
8500 {if(!error)
8501 this._setDocument(root);for(var i=0;i<this._pendingDocumentRequestCallbacks.length;++i){var callback=this._pendingDocumentRequestCallbacks[i];if(callback)
8502 callback(this._document);}
8503 delete this._pendingDocumentRequestCallbacks;}
8504 DOMAgent.getDocument(onDocumentAvailable.bind(this));},existingDocument:function()
8505 {return this._document;},pushNodeToFrontend:function(objectId,callback)
8506 {this._dispatchWhenDocumentAvailable(DOMAgent.requestNode.bind(DOMAgent,objectId),callback);},pushNodeByPathToFrontend:function(path,callback)
8507 {this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bind(DOMAgent,path),callback);},pushNodeByBackendIdToFrontend:function(backendNodeId,callback)
8508 {this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByBackendIdToFrontend.bind(DOMAgent,backendNodeId),callback);},_wrapClientCallback:function(callback)
8509 {if(!callback)
8510 return;return function(error,result)
8511 {callback(error?null:result);}},_dispatchWhenDocumentAvailable:function(func,callback)
8512 {var callbackWrapper=this._wrapClientCallback(callback);function onDocumentAvailable()
8513 {if(this._document)
8514 func(callbackWrapper);else{if(callbackWrapper)
8515 callbackWrapper("No document");}}
8516 this.requestDocument(onDocumentAvailable.bind(this));},_attributeModified:function(nodeId,name,value)
8517 {var node=this._idToDOMNode[nodeId];if(!node)
8518 return;node._setAttribute(name,value);this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified,{node:node,name:name});},_attributeRemoved:function(nodeId,name)
8519 {var node=this._idToDOMNode[nodeId];if(!node)
8520 return;node._removeAttribute(name);this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrRemoved,{node:node,name:name});},_inlineStyleInvalidated:function(nodeIds)
8521 {for(var i=0;i<nodeIds.length;++i)
8522 this._attributeLoadNodeIds[nodeIds[i]]=true;if("_loadNodeAttributesTimeout"in this)
8523 return;this._loadNodeAttributesTimeout=setTimeout(this._loadNodeAttributes.bind(this),20);},_loadNodeAttributes:function()
8524 {function callback(nodeId,error,attributes)
8525 {if(error){return;}
8526 var node=this._idToDOMNode[nodeId];if(node){if(node._setAttributesPayload(attributes))
8527 this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified,{node:node,name:"style"});}}
8528 delete this._loadNodeAttributesTimeout;for(var nodeId in this._attributeLoadNodeIds){var nodeIdAsNumber=parseInt(nodeId,10);DOMAgent.getAttributes(nodeIdAsNumber,callback.bind(this,nodeIdAsNumber));}
8529 this._attributeLoadNodeIds={};},_characterDataModified:function(nodeId,newValue)
8530 {var node=this._idToDOMNode[nodeId];node._nodeValue=newValue;this.dispatchEventToListeners(WebInspector.DOMAgent.Events.CharacterDataModified,node);},nodeForId:function(nodeId)
8531 {return this._idToDOMNode[nodeId]||null;},_documentUpdated:function()
8532 {this._setDocument(null);},_setDocument:function(payload)
8533 {this._idToDOMNode={};if(payload&&"nodeId"in payload)
8534 this._document=new WebInspector.DOMDocument(this,payload);else
8535 this._document=null;this.dispatchEventToListeners(WebInspector.DOMAgent.Events.DocumentUpdated,this._document);},_setDetachedRoot:function(payload)
8536 {if(payload.nodeName==="#document")
8537 new WebInspector.DOMDocument(this,payload);else
8538 new WebInspector.DOMNode(this,null,false,payload);},_setChildNodes:function(parentId,payloads)
8539 {if(!parentId&&payloads.length){this._setDetachedRoot(payloads[0]);return;}
8540 var parent=this._idToDOMNode[parentId];parent._setChildrenPayload(payloads);},_childNodeCountUpdated:function(nodeId,newValue)
8541 {var node=this._idToDOMNode[nodeId];node._childNodeCount=newValue;this.dispatchEventToListeners(WebInspector.DOMAgent.Events.ChildNodeCountUpdated,node);},_childNodeInserted:function(parentId,prevId,payload)
8542 {var parent=this._idToDOMNode[parentId];var prev=this._idToDOMNode[prevId];var node=parent._insertChild(prev,payload);this._idToDOMNode[node.id]=node;this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeInserted,node);},_childNodeRemoved:function(parentId,nodeId)
8543 {var parent=this._idToDOMNode[parentId];var node=this._idToDOMNode[nodeId];parent._removeChild(node);this._unbind(node);this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved,{node:node,parent:parent});},_shadowRootPushed:function(hostId,root)
8544 {var host=this._idToDOMNode[hostId];if(!host)
8545 return;var node=new WebInspector.DOMNode(this,host.ownerDocument,true,root);node.parentNode=host;this._idToDOMNode[node.id]=node;host._shadowRoots.push(node);this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeInserted,node);},_shadowRootPopped:function(hostId,rootId)
8546 {var host=this._idToDOMNode[hostId];if(!host)
8547 return;var root=this._idToDOMNode[rootId];if(!root)
8548 return;host._removeChild(root);this._unbind(root);this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved,{node:root,parent:host});},_pseudoElementAdded:function(parentId,pseudoElement)
8549 {var parent=this._idToDOMNode[parentId];if(!parent)
8550 return;var node=new WebInspector.DOMNode(this,parent.ownerDocument,false,pseudoElement);node.parentNode=parent;this._idToDOMNode[node.id]=node;console.assert(!parent._pseudoElements[node.pseudoType()]);parent._pseudoElements[node.pseudoType()]=node;this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeInserted,node);},_pseudoElementRemoved:function(parentId,pseudoElementId)
8551 {var parent=this._idToDOMNode[parentId];if(!parent)
8552 return;var pseudoElement=this._idToDOMNode[pseudoElementId];if(!pseudoElement)
8553 return;parent._removeChild(pseudoElement);this._unbind(pseudoElement);this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved,{node:pseudoElement,parent:parent});},_unbind:function(node)
8554 {delete this._idToDOMNode[node.id];for(var i=0;node._children&&i<node._children.length;++i)
8555 this._unbind(node._children[i]);for(var i=0;i<node._shadowRoots.length;++i)
8556 this._unbind(node._shadowRoots[i]);var pseudoElements=node.pseudoElements();for(var id in pseudoElements)
8557 this._unbind(pseudoElements[id]);if(node._templateContent)
8558 this._unbind(node._templateContent);},inspectElement:function(nodeId)
8559 {var node=this._idToDOMNode[nodeId];if(node)
8560 this.dispatchEventToListeners(WebInspector.DOMAgent.Events.InspectNodeRequested,nodeId);},_inspectNodeRequested:function(nodeId)
8561 {this.dispatchEventToListeners(WebInspector.DOMAgent.Events.InspectNodeRequested,nodeId);},performSearch:function(query,searchCallback)
8562 {this.cancelSearch();function callback(error,searchId,resultsCount)
8563 {this._searchId=searchId;searchCallback(resultsCount);}
8564 DOMAgent.performSearch(query,callback.bind(this));},searchResult:function(index,callback)
8565 {if(this._searchId)
8566 DOMAgent.getSearchResults(this._searchId,index,index+1,searchResultsCallback.bind(this));else
8567 callback(null);function searchResultsCallback(error,nodeIds)
8568 {if(error){console.error(error);callback(null);return;}
8569 if(nodeIds.length!=1)
8570 return;callback(this.nodeForId(nodeIds[0]));}},cancelSearch:function()
8571 {if(this._searchId){DOMAgent.discardSearchResults(this._searchId);delete this._searchId;}},querySelector:function(nodeId,selectors,callback)
8572 {DOMAgent.querySelector(nodeId,selectors,this._wrapClientCallback(callback));},querySelectorAll:function(nodeId,selectors,callback)
8573 {DOMAgent.querySelectorAll(nodeId,selectors,this._wrapClientCallback(callback));},highlightDOMNode:function(nodeId,mode,objectId)
8574 {if(this._hideDOMNodeHighlightTimeout){clearTimeout(this._hideDOMNodeHighlightTimeout);delete this._hideDOMNodeHighlightTimeout;}
8575 this._highlighter.highlightDOMNode(nodeId||0,this._buildHighlightConfig(mode),objectId);},hideDOMNodeHighlight:function()
8576 {this.highlightDOMNode(0);},highlightDOMNodeForTwoSeconds:function(nodeId)
8577 {this.highlightDOMNode(nodeId);this._hideDOMNodeHighlightTimeout=setTimeout(this.hideDOMNodeHighlight.bind(this),2000);},setInspectModeEnabled:function(enabled,inspectShadowDOM,callback)
8578 {function onDocumentAvailable()
8579 {this._highlighter.setInspectModeEnabled(enabled,inspectShadowDOM,this._buildHighlightConfig(),callback);}
8580 this.requestDocument(onDocumentAvailable.bind(this));},_buildHighlightConfig:function(mode)
8581 {mode=mode||"all";var highlightConfig={showInfo:mode==="all",showRulers:WebInspector.settings.showMetricsRulers.get()};if(mode==="all"||mode==="content")
8582 highlightConfig.contentColor=WebInspector.Color.PageHighlight.Content.toProtocolRGBA();if(mode==="all"||mode==="padding")
8583 highlightConfig.paddingColor=WebInspector.Color.PageHighlight.Padding.toProtocolRGBA();if(mode==="all"||mode==="border")
8584 highlightConfig.borderColor=WebInspector.Color.PageHighlight.Border.toProtocolRGBA();if(mode==="all"||mode==="margin")
8585 highlightConfig.marginColor=WebInspector.Color.PageHighlight.Margin.toProtocolRGBA();if(mode==="all")
8586 highlightConfig.eventTargetColor=WebInspector.Color.PageHighlight.EventTarget.toProtocolRGBA();return highlightConfig;},_markRevision:function(node,callback)
8587 {function wrapperFunction(error)
8588 {if(!error)
8589 this.markUndoableState();if(callback)
8590 callback.apply(this,arguments);}
8591 return wrapperFunction.bind(this);},emulateTouchEventObjects:function(emulationEnabled)
8592 {const injectedFunction=function(){const touchEvents=["ontouchstart","ontouchend","ontouchmove","ontouchcancel"];var recepients=[window.__proto__,document.__proto__];for(var i=0;i<touchEvents.length;++i){for(var j=0;j<recepients.length;++j){if(!(touchEvents[i]in recepients[j]))
8593 Object.defineProperty(recepients[j],touchEvents[i],{value:null,writable:true,configurable:true,enumerable:true});}}}
8594 if(emulationEnabled&&!this._addTouchEventsScriptInjecting){this._addTouchEventsScriptInjecting=true;PageAgent.addScriptToEvaluateOnLoad("("+injectedFunction.toString()+")()",scriptAddedCallback.bind(this));}else{if(typeof this._addTouchEventsScriptId!=="undefined"){PageAgent.removeScriptToEvaluateOnLoad(this._addTouchEventsScriptId);delete this._addTouchEventsScriptId;}}
8595 function scriptAddedCallback(error,scriptId)
8596 {delete this._addTouchEventsScriptInjecting;if(error)
8597 return;this._addTouchEventsScriptId=scriptId;}
8598 PageAgent.setTouchEmulationEnabled(emulationEnabled);},markUndoableState:function()
8599 {DOMAgent.markUndoableState();},undo:function(callback)
8600 {function mycallback(error)
8601 {this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoCompleted);callback(error);}
8602 this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoRequested);DOMAgent.undo(callback);},redo:function(callback)
8603 {function mycallback(error)
8604 {this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoCompleted);callback(error);}
8605 this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoRequested);DOMAgent.redo(callback);},setHighlighter:function(highlighter)
8606 {this._highlighter=highlighter||this._defaultHighlighter;},__proto__:WebInspector.Object.prototype}
8607 WebInspector.DOMDispatcher=function(domAgent)
8608 {this._domAgent=domAgent;}
8609 WebInspector.DOMDispatcher.prototype={documentUpdated:function()
8610 {this._domAgent._documentUpdated();},inspectNodeRequested:function(nodeId)
8611 {this._domAgent._inspectNodeRequested(nodeId);},attributeModified:function(nodeId,name,value)
8612 {this._domAgent._attributeModified(nodeId,name,value);},attributeRemoved:function(nodeId,name)
8613 {this._domAgent._attributeRemoved(nodeId,name);},inlineStyleInvalidated:function(nodeIds)
8614 {this._domAgent._inlineStyleInvalidated(nodeIds);},characterDataModified:function(nodeId,characterData)
8615 {this._domAgent._characterDataModified(nodeId,characterData);},setChildNodes:function(parentId,payloads)
8616 {this._domAgent._setChildNodes(parentId,payloads);},childNodeCountUpdated:function(nodeId,childNodeCount)
8617 {this._domAgent._childNodeCountUpdated(nodeId,childNodeCount);},childNodeInserted:function(parentNodeId,previousNodeId,payload)
8618 {this._domAgent._childNodeInserted(parentNodeId,previousNodeId,payload);},childNodeRemoved:function(parentNodeId,nodeId)
8619 {this._domAgent._childNodeRemoved(parentNodeId,nodeId);},shadowRootPushed:function(hostId,root)
8620 {this._domAgent._shadowRootPushed(hostId,root);},shadowRootPopped:function(hostId,rootId)
8621 {this._domAgent._shadowRootPopped(hostId,rootId);},pseudoElementAdded:function(parentId,pseudoElement)
8622 {this._domAgent._pseudoElementAdded(parentId,pseudoElement);},pseudoElementRemoved:function(parentId,pseudoElementId)
8623 {this._domAgent._pseudoElementRemoved(parentId,pseudoElementId);}}
8624 WebInspector.DOMNodeHighlighter=function(){}
8625 WebInspector.DOMNodeHighlighter.prototype={highlightDOMNode:function(nodeId,config,objectId){},setInspectModeEnabled:function(enabled,inspectShadowDOM,config,callback){}}
8626 WebInspector.DefaultDOMNodeHighlighter=function(){}
8627 WebInspector.DefaultDOMNodeHighlighter.prototype={highlightDOMNode:function(nodeId,config,objectId)
8628 {if(objectId||nodeId)
8629 DOMAgent.highlightNode(config,objectId?undefined:nodeId,objectId);else
8630 DOMAgent.hideHighlight();},setInspectModeEnabled:function(enabled,inspectShadowDOM,config,callback)
8631 {DOMAgent.setInspectModeEnabled(enabled,inspectShadowDOM,config,callback);}}
8632 WebInspector.domAgent;WebInspector.evaluateForTestInFrontend=function(callId,script)
8633 {if(!InspectorFrontendHost.isUnderTest())
8634 return;function invokeMethod()
8635 {var message;try{script=script+"//# sourceURL=evaluateInWebInspector"+callId+".js";var result=window.eval(script);message=typeof result==="undefined"?"\"<undefined>\"":JSON.stringify(result);}catch(e){message=e.toString();}
8636 RuntimeAgent.evaluate("didEvaluateForTestInFrontend("+callId+", "+message+")","test");}
8637 InspectorBackend.runAfterPendingDispatches(invokeMethod);}
8638 WebInspector.Dialog=function(relativeToElement,delegate)
8639 {this._delegate=delegate;this._relativeToElement=relativeToElement;this._glassPane=new WebInspector.GlassPane();this._glassPane.element.tabIndex=0;this._glassPane.element.addEventListener("focus",this._onGlassPaneFocus.bind(this),false);this._element=this._glassPane.element.createChild("div");this._element.tabIndex=0;this._element.addEventListener("focus",this._onFocus.bind(this),false);this._element.addEventListener("keydown",this._onKeyDown.bind(this),false);this._closeKeys=[WebInspector.KeyboardShortcut.Keys.Enter.code,WebInspector.KeyboardShortcut.Keys.Esc.code,];delegate.show(this._element);this._position();this._windowResizeHandler=this._position.bind(this);window.addEventListener("resize",this._windowResizeHandler,true);this._delegate.focus();}
8640 WebInspector.Dialog.currentInstance=function()
8641 {return WebInspector.Dialog._instance;}
8642 WebInspector.Dialog.show=function(relativeToElement,delegate)
8643 {if(WebInspector.Dialog._instance)
8644 return;WebInspector.Dialog._instance=new WebInspector.Dialog(relativeToElement,delegate);}
8645 WebInspector.Dialog.hide=function()
8646 {if(!WebInspector.Dialog._instance)
8647 return;WebInspector.Dialog._instance._hide();}
8648 WebInspector.Dialog.prototype={_hide:function()
8649 {if(this._isHiding)
8650 return;this._isHiding=true;this._delegate.willHide();delete WebInspector.Dialog._instance;this._glassPane.dispose();window.removeEventListener("resize",this._windowResizeHandler,true);},_onGlassPaneFocus:function(event)
8651 {this._hide();},_onFocus:function(event)
8652 {this._delegate.focus();},_position:function()
8653 {this._delegate.position(this._element,this._relativeToElement);},_onKeyDown:function(event)
8654 {if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Tab.code){event.preventDefault();return;}
8655 if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Enter.code)
8656 this._delegate.onEnter();if(this._closeKeys.indexOf(event.keyCode)>=0){this._hide();event.consume(true);}}};WebInspector.DialogDelegate=function()
8657 {}
8658 WebInspector.DialogDelegate.prototype={show:function(element)
8659 {element.appendChild(this.element);this.element.classList.add("dialog-contents");element.classList.add("dialog");},position:function(element,relativeToElement)
8660 {var offset=relativeToElement.offsetRelativeToWindow(window);var positionX=offset.x+(relativeToElement.offsetWidth-element.offsetWidth)/2;positionX=Number.constrain(positionX,0,window.innerWidth-element.offsetWidth);var positionY=offset.y+(relativeToElement.offsetHeight-element.offsetHeight)/2;positionY=Number.constrain(positionY,0,window.innerHeight-element.offsetHeight);element.style.left=positionX+"px";element.style.top=positionY+"px";element.style.position="absolute";},focus:function(){},onEnter:function(){},willHide:function(){},__proto__:WebInspector.Object.prototype}
8661 WebInspector.GoToLineDialog=function(view)
8662 {WebInspector.DialogDelegate.call(this);this.element=document.createElement("div");this.element.className="go-to-line-dialog";this.element.createChild("label").textContent=WebInspector.UIString("Go to line: ");this._input=this.element.createChild("input");this._input.setAttribute("type","text");this._input.setAttribute("size",6);this._goButton=this.element.createChild("button");this._goButton.textContent=WebInspector.UIString("Go");this._goButton.addEventListener("click",this._onGoClick.bind(this),false);this._view=view;}
8663 WebInspector.GoToLineDialog.install=function(panel,viewGetter)
8664 {var goToLineShortcut=WebInspector.GoToLineDialog.createShortcut();panel.registerShortcuts([goToLineShortcut],WebInspector.GoToLineDialog._show.bind(null,viewGetter));}
8665 WebInspector.GoToLineDialog._show=function(viewGetter,event)
8666 {var sourceView=viewGetter();if(!sourceView||!sourceView.canHighlightPosition())
8667 return false;WebInspector.Dialog.show(sourceView.element,new WebInspector.GoToLineDialog(sourceView));return true;}
8668 WebInspector.GoToLineDialog.createShortcut=function()
8669 {var isMac=WebInspector.isMac();var shortcut;return WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.Ctrl);}
8670 WebInspector.GoToLineDialog.prototype={focus:function()
8671 {WebInspector.setCurrentFocusElement(this._input);this._input.select();},_onGoClick:function()
8672 {this._applyLineNumber();WebInspector.Dialog.hide();},_applyLineNumber:function()
8673 {var value=this._input.value;var lineNumber=parseInt(value,10)-1;if(!isNaN(lineNumber)&&lineNumber>=0)
8674 this._view.highlightPosition(lineNumber);},onEnter:function()
8675 {this._applyLineNumber();},__proto__:WebInspector.DialogDelegate.prototype}
8676 WebInspector.SidebarOverlay=function(view,widthSettingName,minimalWidth)
8677 {this.element=document.createElement("div");this.element.className="sidebar-overlay";this._view=view;this._widthSettingName=widthSettingName;this._minimalWidth=minimalWidth;this._savedWidth=minimalWidth||300;if(this._widthSettingName)
8678 WebInspector.settings[this._widthSettingName]=WebInspector.settings.createSetting(this._widthSettingName,undefined);this._resizerElement=document.createElement("div");this._resizerElement.className="sidebar-overlay-resizer";this._installResizer(this._resizerElement);}
8679 WebInspector.SidebarOverlay.prototype={show:function(relativeToElement)
8680 {relativeToElement.appendChild(this.element);relativeToElement.classList.add("sidebar-overlay-shown");this._view.show(this.element);this.element.appendChild(this._resizerElement);if(this._resizerWidgetElement)
8681 this.element.appendChild(this._resizerWidgetElement);this.position(relativeToElement);},position:function(relativeToElement)
8682 {this._totalWidth=relativeToElement.offsetWidth;this._setWidth(this._preferredWidth());},focus:function()
8683 {WebInspector.setCurrentFocusElement(this._view.element);},hide:function()
8684 {var element=this.element.parentElement;if(!element)
8685 return;this._view.detach();element.removeChild(this.element);element.classList.remove("sidebar-overlay-shown");this.element.removeChild(this._resizerElement);if(this._resizerWidgetElement)
8686 this.element.removeChild(this._resizerWidgetElement);},_setWidth:function(newWidth)
8687 {var width=Number.constrain(newWidth,this._minimalWidth,this._totalWidth);if(this._width===width)
8688 return;this.element.style.width=width+"px";this._resizerElement.style.left=(width-3)+"px";this._width=width;this._view.doResize();this._saveWidth();},_preferredWidth:function()
8689 {if(!this._widthSettingName)
8690 return this._savedWidth;return WebInspector.settings[this._widthSettingName].get()||this._savedWidth;},_saveWidth:function()
8691 {this._savedWidth=this._width;if(!this._widthSettingName)
8692 return;WebInspector.settings[this._widthSettingName].set(this._width);},_startResizerDragging:function(event)
8693 {var width=this._width;this._dragOffset=width-event.pageX;return true;},_resizerDragging:function(event)
8694 {var width=event.pageX+this._dragOffset;this._setWidth(width);event.preventDefault();},_endResizerDragging:function(event)
8695 {delete this._dragOffset;},_installResizer:function(resizerElement)
8696 {WebInspector.installDragHandle(resizerElement,this._startResizerDragging.bind(this),this._resizerDragging.bind(this),this._endResizerDragging.bind(this),"ew-resize");},set resizerWidgetElement(resizerWidgetElement)
8697 {this._resizerWidgetElement=resizerWidgetElement;this._installResizer(resizerWidgetElement);}}
8698 WebInspector.SettingsScreen=function(onHide)
8699 {WebInspector.HelpScreen.call(this);this.element.id="settings-screen";this._onHide=onHide;this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.element.classList.add("help-window-main");var settingsLabelElement=document.createElement("div");settingsLabelElement.className="help-window-label";settingsLabelElement.createTextChild(WebInspector.UIString("Settings"));this._tabbedPane.element.insertBefore(settingsLabelElement,this._tabbedPane.element.firstChild);this._tabbedPane.element.appendChild(this._createCloseButton());this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.General,WebInspector.UIString("General"),new WebInspector.GenericSettingsTab());this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Workspace,WebInspector.UIString("Workspace"),new WebInspector.WorkspaceSettingsTab());if(WebInspector.experimentsSettings.experimentsEnabled)
8700 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Experiments,WebInspector.UIString("Experiments"),new WebInspector.ExperimentsSettingsTab());this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts,WebInspector.UIString("Shortcuts"),WebInspector.shortcutsScreen.createShortcutsTabView());this._tabbedPane.shrinkableTabs=false;this._tabbedPane.verticalTabLayout=true;this._lastSelectedTabSetting=WebInspector.settings.createSetting("lastSelectedSettingsTab",WebInspector.SettingsScreen.Tabs.General);this.selectTab(this._lastSelectedTabSetting.get());this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);}
8701 WebInspector.SettingsScreen.regexValidator=function(text)
8702 {var regex;try{regex=new RegExp(text);}catch(e){}
8703 return regex?null:WebInspector.UIString("Invalid pattern");}
8704 WebInspector.SettingsScreen.integerValidator=function(min,max,text)
8705 {var value=Number(text);if(isNaN(value))
8706 return WebInspector.UIString("Invalid number format");if(value<min||value>max)
8707 return WebInspector.UIString("Value is out of range [%d, %d]",min,max);return null;}
8708 WebInspector.SettingsScreen.Tabs={General:"general",Overrides:"overrides",Workspace:"workspace",Experiments:"experiments",Shortcuts:"shortcuts"}
8709 WebInspector.SettingsScreen.prototype={selectTab:function(tabId)
8710 {this._tabbedPane.selectTab(tabId);},_tabSelected:function(event)
8711 {this._lastSelectedTabSetting.set(this._tabbedPane.selectedTabId);},wasShown:function()
8712 {this._tabbedPane.show(this.element);WebInspector.HelpScreen.prototype.wasShown.call(this);},isClosingKey:function(keyCode)
8713 {return[WebInspector.KeyboardShortcut.Keys.Enter.code,WebInspector.KeyboardShortcut.Keys.Esc.code,].indexOf(keyCode)>=0;},willHide:function()
8714 {this._onHide();WebInspector.HelpScreen.prototype.willHide.call(this);},__proto__:WebInspector.HelpScreen.prototype}
8715 WebInspector.SettingsTab=function(name,id)
8716 {WebInspector.View.call(this);this.element.className="settings-tab-container";if(id)
8717 this.element.id=id;var header=this.element.createChild("header");header.createChild("h3").appendChild(document.createTextNode(name));this.containerElement=this.element.createChild("div","help-container-wrapper").createChild("div","settings-tab help-content help-container");}
8718 WebInspector.SettingsTab.createCheckbox=function(name,getter,setter,omitParagraphElement,inputElement,tooltip)
8719 {var input=inputElement||document.createElement("input");input.type="checkbox";input.name=name;input.checked=getter();function listener()
8720 {setter(input.checked);}
8721 input.addEventListener("click",listener,false);var label=document.createElement("label");label.appendChild(input);label.appendChild(document.createTextNode(name));if(tooltip)
8722 label.title=tooltip;if(omitParagraphElement)
8723 return label;var p=document.createElement("p");p.appendChild(label);return p;}
8724 WebInspector.SettingsTab.createSettingCheckbox=function(name,setting,omitParagraphElement,inputElement,tooltip)
8725 {return WebInspector.SettingsTab.createCheckbox(name,setting.get.bind(setting),setting.set.bind(setting),omitParagraphElement,inputElement,tooltip);}
8726 WebInspector.SettingsTab.createSettingFieldset=function(setting)
8727 {var fieldset=document.createElement("fieldset");fieldset.disabled=!setting.get();setting.addChangeListener(settingChanged);return fieldset;function settingChanged()
8728 {fieldset.disabled=!setting.get();}}
8729 WebInspector.SettingsTab.prototype={_appendSection:function(name)
8730 {var block=this.containerElement.createChild("div","help-block");if(name)
8731 block.createChild("div","help-section-title").textContent=name;return block;},_createSelectSetting:function(name,options,setting)
8732 {var p=document.createElement("p");var labelElement=p.createChild("label");labelElement.textContent=name;var select=p.createChild("select");var settingValue=setting.get();for(var i=0;i<options.length;++i){var option=options[i];select.add(new Option(option[0],option[1]));if(settingValue===option[1])
8733 select.selectedIndex=i;}
8734 function changeListener(e)
8735 {setting.set(options[select.selectedIndex][1]);}
8736 select.addEventListener("change",changeListener,false);return p;},_createInputSetting:function(label,setting,numeric,maxLength,width,validatorCallback)
8737 {var p=document.createElement("p");var labelElement=p.createChild("label");labelElement.textContent=label;var inputElement=p.createChild("input");inputElement.value=setting.get();inputElement.type="text";if(numeric)
8738 inputElement.className="numeric";if(maxLength)
8739 inputElement.maxLength=maxLength;if(width)
8740 inputElement.style.width=width;if(validatorCallback){var errorMessageLabel=p.createChild("div");errorMessageLabel.classList.add("field-error-message");errorMessageLabel.style.color="DarkRed";inputElement.oninput=function()
8741 {var error=validatorCallback(inputElement.value);if(!error)
8742 error="";errorMessageLabel.textContent=error;};}
8743 function onBlur()
8744 {setting.set(numeric?Number(inputElement.value):inputElement.value);}
8745 inputElement.addEventListener("blur",onBlur,false);return p;},_createCustomSetting:function(name,element)
8746 {var p=document.createElement("p");var fieldsetElement=document.createElement("fieldset");fieldsetElement.createChild("label").textContent=name;fieldsetElement.appendChild(element);p.appendChild(fieldsetElement);return p;},__proto__:WebInspector.View.prototype}
8747 WebInspector.GenericSettingsTab=function()
8748 {WebInspector.SettingsTab.call(this,WebInspector.UIString("General"),"general-tab-content");var p=this._appendSection();p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Disable cache (while DevTools is open)"),WebInspector.settings.cacheDisabled));var disableJSElement=WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Disable JavaScript"),WebInspector.settings.javaScriptDisabled);p.appendChild(disableJSElement);WebInspector.settings.javaScriptDisabled.addChangeListener(this._javaScriptDisabledChanged,this);this._disableJSCheckbox=disableJSElement.getElementsByTagName("input")[0];this._updateScriptDisabledCheckbox();p=this._appendSection(WebInspector.UIString("Appearance"));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Show 'Emulation' view in console drawer."),WebInspector.settings.showEmulationViewInDrawer));this._appendDrawerNote(p.lastElementChild);p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Show 'Rendering' view in console drawer."),WebInspector.settings.showRenderingViewInDrawer));this._appendDrawerNote(p.lastElementChild);p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Split panels vertically when docked to right"),WebInspector.settings.splitVerticallyWhenDockedToRight));p=this._appendSection(WebInspector.UIString("Elements"));var colorFormatElement=this._createSelectSetting(WebInspector.UIString("Color format"),[[WebInspector.UIString("As authored"),WebInspector.Color.Format.Original],["HEX: #DAC0DE",WebInspector.Color.Format.HEX],["RGB: rgb(128, 255, 255)",WebInspector.Color.Format.RGB],["HSL: hsl(300, 80%, 90%)",WebInspector.Color.Format.HSL]],WebInspector.settings.colorFormat);p.appendChild(colorFormatElement);p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Show user agent styles"),WebInspector.settings.showUserAgentStyles));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Word wrap"),WebInspector.settings.domWordWrap));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Show Shadow DOM"),WebInspector.settings.showShadowDOM));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Show rulers"),WebInspector.settings.showMetricsRulers));p=this._appendSection(WebInspector.UIString("Sources"));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Search in content scripts"),WebInspector.settings.searchInContentScripts));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Enable JavaScript source maps"),WebInspector.settings.jsSourceMapsEnabled));var checkbox=WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Enable CSS source maps"),WebInspector.settings.cssSourceMapsEnabled);p.appendChild(checkbox);var fieldset=WebInspector.SettingsTab.createSettingFieldset(WebInspector.settings.cssSourceMapsEnabled);var autoReloadCSSCheckbox=fieldset.createChild("input");fieldset.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Auto-reload generated CSS"),WebInspector.settings.cssReloadEnabled,false,autoReloadCSSCheckbox));checkbox.appendChild(fieldset);var indentationElement=this._createSelectSetting(WebInspector.UIString("Default indentation"),[[WebInspector.UIString("2 spaces"),WebInspector.TextUtils.Indent.TwoSpaces],[WebInspector.UIString("4 spaces"),WebInspector.TextUtils.Indent.FourSpaces],[WebInspector.UIString("8 spaces"),WebInspector.TextUtils.Indent.EightSpaces],[WebInspector.UIString("Tab character"),WebInspector.TextUtils.Indent.TabCharacter]],WebInspector.settings.textEditorIndent);p.appendChild(indentationElement);p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Detect indentation"),WebInspector.settings.textEditorAutoDetectIndent));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Autocompletion"),WebInspector.settings.textEditorAutocompletion));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Bracket matching"),WebInspector.settings.textEditorBracketMatching));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Show whitespace characters"),WebInspector.settings.showWhitespacesInEditor));if(WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnabled()){checkbox=WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Skip stepping through sources with particular names"),WebInspector.settings.skipStackFramesSwitch);fieldset=WebInspector.SettingsTab.createSettingFieldset(WebInspector.settings.skipStackFramesSwitch);fieldset.appendChild(this._createInputSetting(WebInspector.UIString("Pattern"),WebInspector.settings.skipStackFramesPattern,false,1000,"100px",WebInspector.SettingsScreen.regexValidator));checkbox.appendChild(fieldset);p.appendChild(checkbox);}
8749 WebInspector.settings.skipStackFramesSwitch.addChangeListener(this._skipStackFramesSwitchOrPatternChanged,this);WebInspector.settings.skipStackFramesPattern.addChangeListener(this._skipStackFramesSwitchOrPatternChanged,this);p=this._appendSection(WebInspector.UIString("Profiler"));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Show advanced heap snapshot properties"),WebInspector.settings.showAdvancedHeapSnapshotProperties));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("High resolution CPU profiling"),WebInspector.settings.highResolutionCpuProfiling));p=this._appendSection(WebInspector.UIString("Console"));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Log XMLHttpRequests"),WebInspector.settings.monitoringXHREnabled));p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIString("Preserve log upon navigation"),WebInspector.settings.preserveConsoleLog));if(WebInspector.extensionServer.hasExtensions()){var handlerSelector=new WebInspector.HandlerSelector(WebInspector.openAnchorLocationRegistry);p=this._appendSection(WebInspector.UIString("Extensions"));p.appendChild(this._createCustomSetting(WebInspector.UIString("Open links in"),handlerSelector.element));}
8750 p=this._appendSection();var panelShortcutTitle=WebInspector.UIString("Enable %s + 1-9 shortcut to switch panels",WebInspector.isMac()?"Cmd":"Ctrl");p.appendChild(WebInspector.SettingsTab.createSettingCheckbox(panelShortcutTitle,WebInspector.settings.shortcutPanelSwitch));}
8751 WebInspector.GenericSettingsTab.prototype={_updateScriptDisabledCheckbox:function()
8752 {function executionStatusCallback(error,status)
8753 {if(error||!status)
8754 return;switch(status){case"forbidden":this._disableJSCheckbox.checked=true;this._disableJSCheckbox.disabled=true;break;case"disabled":this._disableJSCheckbox.checked=true;break;default:this._disableJSCheckbox.checked=false;break;}}
8755 PageAgent.getScriptExecutionStatus(executionStatusCallback.bind(this));},_javaScriptDisabledChanged:function()
8756 {PageAgent.setScriptExecutionDisabled(WebInspector.settings.javaScriptDisabled.get(),this._updateScriptDisabledCheckbox.bind(this));},_skipStackFramesSwitchOrPatternChanged:function()
8757 {WebInspector.DebuggerModel.applySkipStackFrameSettings();},_appendDrawerNote:function(p)
8758 {var noteElement=p.createChild("div","help-field-note");noteElement.createTextChild("Hit ");noteElement.createChild("span","help-key").textContent="Esc";noteElement.createTextChild(WebInspector.UIString(" or click the"));noteElement.appendChild(new WebInspector.StatusBarButton(WebInspector.UIString("Drawer"),"console-status-bar-item").element);noteElement.createTextChild(WebInspector.UIString("toolbar item"));},__proto__:WebInspector.SettingsTab.prototype}
8759 WebInspector.WorkspaceSettingsTab=function()
8760 {WebInspector.SettingsTab.call(this,WebInspector.UIString("Workspace"),"workspace-tab-content");WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded,this._fileSystemAdded,this);WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved,this._fileSystemRemoved,this);this._commonSection=this._appendSection(WebInspector.UIString("Common"));var folderExcludePatternInput=this._createInputSetting(WebInspector.UIString("Folder exclude pattern"),WebInspector.settings.workspaceFolderExcludePattern,false,0,"270px",WebInspector.SettingsScreen.regexValidator);this._commonSection.appendChild(folderExcludePatternInput);this._fileSystemsSection=this._appendSection(WebInspector.UIString("Folders"));this._fileSystemsListContainer=this._fileSystemsSection.createChild("p","settings-list-container");this._addFileSystemRowElement=this._fileSystemsSection.createChild("div");var addFileSystemButton=this._addFileSystemRowElement.createChild("input","settings-tab-text-button");addFileSystemButton.type="button";addFileSystemButton.value=WebInspector.UIString("Add folder\u2026");addFileSystemButton.addEventListener("click",this._addFileSystemClicked.bind(this));this._editFileSystemButton=this._addFileSystemRowElement.createChild("input","settings-tab-text-button");this._editFileSystemButton.type="button";this._editFileSystemButton.value=WebInspector.UIString("Edit\u2026");this._editFileSystemButton.addEventListener("click",this._editFileSystemClicked.bind(this));this._updateEditFileSystemButtonState();this._reset();}
8761 WebInspector.WorkspaceSettingsTab.prototype={wasShown:function()
8762 {WebInspector.SettingsTab.prototype.wasShown.call(this);this._reset();},_reset:function()
8763 {this._resetFileSystems();},_resetFileSystems:function()
8764 {this._fileSystemsListContainer.removeChildren();var fileSystemPaths=WebInspector.isolatedFileSystemManager.mapping().fileSystemPaths();delete this._fileSystemsList;if(!fileSystemPaths.length){var noFileSystemsMessageElement=this._fileSystemsListContainer.createChild("div","no-file-systems-message");noFileSystemsMessageElement.textContent=WebInspector.UIString("You have no file systems added.");return;}
8765 this._fileSystemsList=new WebInspector.SettingsList(["path"],this._renderFileSystem.bind(this));this._fileSystemsList.element.classList.add("file-systems-list");this._fileSystemsList.addEventListener(WebInspector.SettingsList.Events.Selected,this._fileSystemSelected.bind(this));this._fileSystemsList.addEventListener(WebInspector.SettingsList.Events.Removed,this._fileSystemRemovedfromList.bind(this));this._fileSystemsList.addEventListener(WebInspector.SettingsList.Events.DoubleClicked,this._fileSystemDoubleClicked.bind(this));this._fileSystemsListContainer.appendChild(this._fileSystemsList.element);for(var i=0;i<fileSystemPaths.length;++i)
8766 this._fileSystemsList.addItem(fileSystemPaths[i]);this._updateEditFileSystemButtonState();},_updateEditFileSystemButtonState:function()
8767 {this._editFileSystemButton.disabled=!this._selectedFileSystemPath();},_fileSystemSelected:function(event)
8768 {this._updateEditFileSystemButtonState();},_fileSystemDoubleClicked:function(event)
8769 {var id=(event.data);this._editFileSystem(id);},_editFileSystemClicked:function(event)
8770 {this._editFileSystem(this._selectedFileSystemPath());},_editFileSystem:function(id)
8771 {WebInspector.EditFileSystemDialog.show(WebInspector.inspectorView.devtoolsElement(),id);},_createRemoveButton:function(handler)
8772 {var removeButton=document.createElement("button");removeButton.classList.add("button");removeButton.classList.add("remove-item-button");removeButton.value=WebInspector.UIString("Remove");if(handler)
8773 removeButton.addEventListener("click",handler,false);else
8774 removeButton.disabled=true;return removeButton;},_renderFileSystem:function(columnElement,column,id)
8775 {if(!id)
8776 return"";var fileSystemPath=id;var textElement=columnElement.createChild("span","list-column-text");var pathElement=textElement.createChild("span","file-system-path");pathElement.title=fileSystemPath;const maxTotalPathLength=55;const maxFolderNameLength=30;var lastIndexOfSlash=fileSystemPath.lastIndexOf(WebInspector.isWin()?"\\":"/");var folderName=fileSystemPath.substr(lastIndexOfSlash+1);var folderPath=fileSystemPath.substr(0,lastIndexOfSlash+1);folderPath=folderPath.trimMiddle(maxTotalPathLength-Math.min(maxFolderNameLength,folderName.length));folderName=folderName.trimMiddle(maxFolderNameLength);var folderPathElement=pathElement.createChild("span");folderPathElement.textContent=folderPath;var nameElement=pathElement.createChild("span","file-system-path-name");nameElement.textContent=folderName;},_fileSystemRemovedfromList:function(event)
8777 {var id=(event.data);if(!id)
8778 return;WebInspector.isolatedFileSystemManager.removeFileSystem(id);},_addFileSystemClicked:function()
8779 {WebInspector.isolatedFileSystemManager.addFileSystem();},_fileSystemAdded:function(event)
8780 {var fileSystem=(event.data);if(!this._fileSystemsList)
8781 this._reset();else
8782 this._fileSystemsList.addItem(fileSystem.path());},_fileSystemRemoved:function(event)
8783 {var fileSystem=(event.data);var selectedFileSystemPath=this._selectedFileSystemPath();if(this._fileSystemsList.itemForId(fileSystem.path()))
8784 this._fileSystemsList.removeItem(fileSystem.path());if(!this._fileSystemsList.itemIds().length)
8785 this._reset();this._updateEditFileSystemButtonState();},_selectedFileSystemPath:function()
8786 {return this._fileSystemsList?this._fileSystemsList.selectedId():null;},__proto__:WebInspector.SettingsTab.prototype}
8787 WebInspector.ExperimentsSettingsTab=function()
8788 {WebInspector.SettingsTab.call(this,WebInspector.UIString("Experiments"),"experiments-tab-content");var experiments=WebInspector.experimentsSettings.experiments;if(experiments.length){var experimentsSection=this._appendSection();experimentsSection.appendChild(this._createExperimentsWarningSubsection());for(var i=0;i<experiments.length;++i)
8789 experimentsSection.appendChild(this._createExperimentCheckbox(experiments[i]));}}
8790 WebInspector.ExperimentsSettingsTab.prototype={_createExperimentsWarningSubsection:function()
8791 {var subsection=document.createElement("div");var warning=subsection.createChild("span","settings-experiments-warning-subsection-warning");warning.textContent=WebInspector.UIString("WARNING:");subsection.appendChild(document.createTextNode(" "));var message=subsection.createChild("span","settings-experiments-warning-subsection-message");message.textContent=WebInspector.UIString("These experiments could be dangerous and may require restart.");return subsection;},_createExperimentCheckbox:function(experiment)
8792 {var input=document.createElement("input");input.type="checkbox";input.name=experiment.name;input.checked=experiment.isEnabled();function listener()
8793 {experiment.setEnabled(input.checked);}
8794 input.addEventListener("click",listener,false);var p=document.createElement("p");var label=document.createElement("label");label.appendChild(input);label.appendChild(document.createTextNode(WebInspector.UIString(experiment.title)));p.appendChild(label);return p;},__proto__:WebInspector.SettingsTab.prototype}
8795 WebInspector.SettingsController=function()
8796 {this._statusBarButton=new WebInspector.StatusBarButton(WebInspector.UIString("Settings"),"settings-status-bar-item");this._statusBarButton.element.addEventListener("mouseup",this._mouseUp.bind(this),false);this._settingsScreen;}
8797 WebInspector.SettingsController.prototype={get statusBarItem()
8798 {return this._statusBarButton.element;},_mouseUp:function()
8799 {this.showSettingsScreen();},_onHideSettingsScreen:function()
8800 {delete this._settingsScreenVisible;},showSettingsScreen:function(tabId)
8801 {if(!this._settingsScreen)
8802 this._settingsScreen=new WebInspector.SettingsScreen(this._onHideSettingsScreen.bind(this));if(tabId)
8803 this._settingsScreen.selectTab(tabId);this._settingsScreen.showModal();this._settingsScreenVisible=true;},_hideSettingsScreen:function()
8804 {if(this._settingsScreen)
8805 this._settingsScreen.hide();},resize:function()
8806 {if(this._settingsScreen&&this._settingsScreen.isShowing())
8807 this._settingsScreen.doResize();}}
8808 WebInspector.SettingsList=function(columns,itemRenderer)
8809 {this.element=document.createElement("div");this.element.classList.add("settings-list");this.element.tabIndex=-1;this._itemRenderer=itemRenderer;this._listItems={};this._ids=[];this._columns=columns;}
8810 WebInspector.SettingsList.Events={Selected:"Selected",Removed:"Removed",DoubleClicked:"DoubleClicked",}
8811 WebInspector.SettingsList.prototype={addItem:function(itemId,beforeId)
8812 {var listItem=document.createElement("div");listItem._id=itemId;listItem.classList.add("settings-list-item");if(typeof beforeId!==undefined)
8813 this.element.insertBefore(listItem,this._listItems[beforeId]);else
8814 this.element.appendChild(listItem);var listItemContents=listItem.createChild("div","settings-list-item-contents");var listItemColumnsElement=listItemContents.createChild("div","settings-list-item-columns");listItem.columnElements={};for(var i=0;i<this._columns.length;++i){var columnElement=listItemColumnsElement.createChild("div","list-column");var columnId=this._columns[i];listItem.columnElements[columnId]=columnElement;this._itemRenderer(columnElement,columnId,itemId);}
8815 var removeItemButton=this._createRemoveButton(removeItemClicked.bind(this));listItemContents.addEventListener("click",this.selectItem.bind(this,itemId),false);listItemContents.addEventListener("dblclick",this._onDoubleClick.bind(this,itemId),false);listItemContents.appendChild(removeItemButton);this._listItems[itemId]=listItem;if(typeof beforeId!==undefined)
8816 this._ids.splice(this._ids.indexOf(beforeId),0,itemId);else
8817 this._ids.push(itemId);function removeItemClicked(event)
8818 {removeItemButton.disabled=true;this.removeItem(itemId);this.dispatchEventToListeners(WebInspector.SettingsList.Events.Removed,itemId);event.consume();}
8819 return listItem;},removeItem:function(id)
8820 {this._listItems[id].remove();delete this._listItems[id];this._ids.remove(id);if(id===this._selectedId){delete this._selectedId;if(this._ids.length)
8821 this.selectItem(this._ids[0]);}},itemIds:function()
8822 {return this._ids.slice();},columns:function()
8823 {return this._columns.slice();},selectedId:function()
8824 {return this._selectedId;},selectedItem:function()
8825 {return this._selectedId?this._listItems[this._selectedId]:null;},itemForId:function(itemId)
8826 {return this._listItems[itemId];},_onDoubleClick:function(id,event)
8827 {this.dispatchEventToListeners(WebInspector.SettingsList.Events.DoubleClicked,id);},selectItem:function(id,event)
8828 {if(typeof this._selectedId!=="undefined"){this._listItems[this._selectedId].classList.remove("selected");}
8829 this._selectedId=id;if(typeof this._selectedId!=="undefined"){this._listItems[this._selectedId].classList.add("selected");}
8830 this.dispatchEventToListeners(WebInspector.SettingsList.Events.Selected,id);if(event)
8831 event.consume();},_createRemoveButton:function(handler)
8832 {var removeButton=document.createElement("button");removeButton.classList.add("remove-item-button");removeButton.value=WebInspector.UIString("Remove");removeButton.addEventListener("click",handler,false);return removeButton;},__proto__:WebInspector.Object.prototype}
8833 WebInspector.EditableSettingsList=function(columns,valuesProvider,validateHandler,editHandler)
8834 {WebInspector.SettingsList.call(this,columns,this._renderColumn.bind(this));this._validateHandler=validateHandler;this._editHandler=editHandler;this._valuesProvider=valuesProvider;this._addInputElements={};this._editInputElements={};this._textElements={};this._addMappingItem=this.addItem(null);this._addMappingItem.classList.add("item-editing");this._addMappingItem.classList.add("add-list-item");}
8835 WebInspector.EditableSettingsList.prototype={addItem:function(itemId,beforeId)
8836 {var listItem=WebInspector.SettingsList.prototype.addItem.call(this,itemId,beforeId);listItem.classList.add("editable");return listItem;},_renderColumn:function(columnElement,columnId,itemId)
8837 {columnElement.classList.add("settings-list-column-"+columnId);var placeholder=(columnId==="url")?WebInspector.UIString("URL prefix"):WebInspector.UIString("Folder path");if(itemId===null){var inputElement=columnElement.createChild("input","list-column-editor");inputElement.placeholder=placeholder;inputElement.addEventListener("blur",this._onAddMappingInputBlur.bind(this));inputElement.addEventListener("input",this._validateEdit.bind(this,itemId));this._addInputElements[columnId]=inputElement;return;}
8838 var validItemId=itemId;if(!this._editInputElements[itemId])
8839 this._editInputElements[itemId]={};if(!this._textElements[itemId])
8840 this._textElements[itemId]={};var value=this._valuesProvider(itemId,columnId);var textElement=columnElement.createChild("span","list-column-text");textElement.textContent=value;textElement.title=value;columnElement.addEventListener("click",rowClicked.bind(this),false);this._textElements[itemId][columnId]=textElement;var inputElement=columnElement.createChild("input","list-column-editor");inputElement.value=value;inputElement.addEventListener("blur",this._editMappingBlur.bind(this,itemId));inputElement.addEventListener("input",this._validateEdit.bind(this,itemId));columnElement.inputElement=inputElement;this._editInputElements[itemId][columnId]=inputElement;function rowClicked(event)
8841 {if(itemId===this._editingId)
8842 return;event.consume();console.assert(!this._editingId);this._editingId=validItemId;var listItem=this.itemForId(validItemId);listItem.classList.add("item-editing");var inputElement=event.target.inputElement||this._editInputElements[validItemId][this.columns()[0]];inputElement.focus();inputElement.select();}},_data:function(itemId)
8843 {var inputElements=this._inputElements(itemId);var data={};var columns=this.columns();for(var i=0;i<columns.length;++i)
8844 data[columns[i]]=inputElements[columns[i]].value;return data;},_inputElements:function(itemId)
8845 {if(!itemId)
8846 return this._addInputElements;return this._editInputElements[itemId]||null;},_validateEdit:function(itemId)
8847 {var errorColumns=this._validateHandler(itemId,this._data(itemId));var hasChanges=this._hasChanges(itemId);var columns=this.columns();for(var i=0;i<columns.length;++i){var columnId=columns[i];var inputElement=this._inputElements(itemId)[columnId];if(hasChanges&&errorColumns.indexOf(columnId)!==-1)
8848 inputElement.classList.add("editable-item-error");else
8849 inputElement.classList.remove("editable-item-error");}
8850 return!errorColumns.length;},_hasChanges:function(itemId)
8851 {var hasChanges=false;var columns=this.columns();for(var i=0;i<columns.length;++i){var columnId=columns[i];var oldValue=itemId?this._textElements[itemId][columnId].textContent:"";var newValue=this._inputElements(itemId)[columnId].value;if(oldValue!==newValue){hasChanges=true;break;}}
8852 return hasChanges;},_editMappingBlur:function(itemId,event)
8853 {var inputElements=Object.values(this._editInputElements[itemId]);if(inputElements.indexOf(event.relatedTarget)!==-1)
8854 return;var listItem=this.itemForId(itemId);listItem.classList.remove("item-editing");delete this._editingId;if(!this._hasChanges(itemId))
8855 return;if(!this._validateEdit(itemId)){var columns=this.columns();for(var i=0;i<columns.length;++i){var columnId=columns[i];var inputElement=this._editInputElements[itemId][columnId];inputElement.value=this._textElements[itemId][columnId].textContent;inputElement.classList.remove("editable-item-error");}
8856 return;}
8857 this._editHandler(itemId,this._data(itemId));},_onAddMappingInputBlur:function(event)
8858 {var inputElements=Object.values(this._addInputElements);if(inputElements.indexOf(event.relatedTarget)!==-1)
8859 return;if(!this._hasChanges(null))
8860 return;if(!this._validateEdit(null))
8861 return;this._editHandler(null,this._data(null));var columns=this.columns();for(var i=0;i<columns.length;++i){var columnId=columns[i];var inputElement=this._addInputElements[columnId];inputElement.value="";}},__proto__:WebInspector.SettingsList.prototype}
8862 WebInspector.settingsController;WebInspector.EditFileSystemDialog=function(fileSystemPath)
8863 {WebInspector.DialogDelegate.call(this);this._fileSystemPath=fileSystemPath;this.element=document.createElement("div");this.element.className="edit-file-system-dialog";var header=this.element.createChild("div","header");var headerText=header.createChild("span");headerText.textContent=WebInspector.UIString("Edit file system");var closeButton=header.createChild("div","close-button-gray done-button");closeButton.addEventListener("click",this._onDoneClick.bind(this),false);var contents=this.element.createChild("div","contents");WebInspector.isolatedFileSystemManager.mapping().addEventListener(WebInspector.FileSystemMapping.Events.FileMappingAdded,this._fileMappingAdded,this);WebInspector.isolatedFileSystemManager.mapping().addEventListener(WebInspector.FileSystemMapping.Events.FileMappingRemoved,this._fileMappingRemoved,this);WebInspector.isolatedFileSystemManager.mapping().addEventListener(WebInspector.FileSystemMapping.Events.ExcludedFolderAdded,this._excludedFolderAdded,this);WebInspector.isolatedFileSystemManager.mapping().addEventListener(WebInspector.FileSystemMapping.Events.ExcludedFolderRemoved,this._excludedFolderRemoved,this);var blockHeader=contents.createChild("div","block-header");blockHeader.textContent=WebInspector.UIString("Mappings");this._fileMappingsSection=contents.createChild("div","file-mappings-section");this._fileMappingsListContainer=this._fileMappingsSection.createChild("div","settings-list-container");var entries=WebInspector.isolatedFileSystemManager.mapping().mappingEntries(this._fileSystemPath);this._fileMappingsList=new WebInspector.EditableSettingsList(["url","path"],this._fileMappingValuesProvider.bind(this),this._fileMappingValidate.bind(this),this._fileMappingEdit.bind(this));this._fileMappingsList.addEventListener(WebInspector.SettingsList.Events.Removed,this._fileMappingRemovedfromList.bind(this));this._fileMappingsList.element.classList.add("file-mappings-list");this._fileMappingsListContainer.appendChild(this._fileMappingsList.element);this._entries={};for(var i=0;i<entries.length;++i)
8864 this._addMappingRow(entries[i]);blockHeader=contents.createChild("div","block-header");blockHeader.textContent=WebInspector.UIString("Excluded folders");this._excludedFolderListSection=contents.createChild("div","excluded-folders-section");this._excludedFolderListContainer=this._excludedFolderListSection.createChild("div","settings-list-container");var excludedFolderEntries=WebInspector.isolatedFileSystemManager.mapping().excludedFolders(fileSystemPath);this._excludedFolderList=new WebInspector.EditableSettingsList(["path"],this._excludedFolderValueProvider.bind(this),this._excludedFolderValidate.bind(this),this._excludedFolderEdit.bind(this));this._excludedFolderList.addEventListener(WebInspector.SettingsList.Events.Removed,this._excludedFolderRemovedfromList.bind(this));this._excludedFolderList.element.classList.add("excluded-folders-list");this._excludedFolderListContainer.appendChild(this._excludedFolderList.element);this._excludedFolderEntries=new StringMap();for(var i=0;i<excludedFolderEntries.length;++i)
8865 this._addExcludedFolderRow(excludedFolderEntries[i]);this.element.tabIndex=0;}
8866 WebInspector.EditFileSystemDialog.show=function(element,fileSystemPath)
8867 {WebInspector.Dialog.show(element,new WebInspector.EditFileSystemDialog(fileSystemPath));var glassPane=document.getElementById("glass-pane");glassPane.classList.add("settings-glass-pane");}
8868 WebInspector.EditFileSystemDialog.prototype={show:function(element)
8869 {element.appendChild(this.element);this.element.classList.add("dialog-contents");element.classList.add("settings-dialog");element.classList.add("settings-tab");this._dialogElement=element;},_resize:function()
8870 {if(!this._dialogElement||!this._relativeToElement)
8871 return;const width=540;const minHeight=150;var maxHeight=this._relativeToElement.offsetHeight-10;maxHeight=Math.max(minHeight,maxHeight);this._dialogElement.style.maxHeight=maxHeight+"px";this._dialogElement.style.width=width+"px";WebInspector.DialogDelegate.prototype.position(this._dialogElement,this._relativeToElement);},position:function(element,relativeToElement)
8872 {this._relativeToElement=relativeToElement;this._resize();},willHide:function(event)
8873 {},_fileMappingAdded:function(event)
8874 {var entry=(event.data);this._addMappingRow(entry);},_fileMappingRemoved:function(event)
8875 {var entry=(event.data);if(this._fileSystemPath!==entry.fileSystemPath)
8876 return;delete this._entries[entry.urlPrefix];if(this._fileMappingsList.itemForId(entry.urlPrefix))
8877 this._fileMappingsList.removeItem(entry.urlPrefix);this._resize();},_fileMappingValuesProvider:function(itemId,columnId)
8878 {if(!itemId)
8879 return"";var entry=this._entries[itemId];switch(columnId){case"url":return entry.urlPrefix;case"path":return entry.pathPrefix;default:console.assert("Should not be reached.");}
8880 return"";},_fileMappingValidate:function(itemId,data)
8881 {var oldPathPrefix=itemId?this._entries[itemId].pathPrefix:null;return this._validateMapping(data["url"],itemId,data["path"],oldPathPrefix);},_fileMappingEdit:function(itemId,data)
8882 {if(itemId){var urlPrefix=itemId;var pathPrefix=this._entries[itemId].pathPrefix;var fileSystemPath=this._entries[itemId].fileSystemPath;WebInspector.isolatedFileSystemManager.mapping().removeFileMapping(fileSystemPath,urlPrefix,pathPrefix);}
8883 this._addFileMapping(data["url"],data["path"]);},_validateMapping:function(urlPrefix,allowedURLPrefix,path,allowedPathPrefix)
8884 {var columns=[];if(!this._checkURLPrefix(urlPrefix,allowedURLPrefix))
8885 columns.push("url");if(!this._checkPathPrefix(path,allowedPathPrefix))
8886 columns.push("path");return columns;},_fileMappingRemovedfromList:function(event)
8887 {var urlPrefix=(event.data);if(!urlPrefix)
8888 return;var entry=this._entries[urlPrefix];WebInspector.isolatedFileSystemManager.mapping().removeFileMapping(entry.fileSystemPath,entry.urlPrefix,entry.pathPrefix);},_addFileMapping:function(urlPrefix,pathPrefix)
8889 {var normalizedURLPrefix=this._normalizePrefix(urlPrefix);var normalizedPathPrefix=this._normalizePrefix(pathPrefix);WebInspector.isolatedFileSystemManager.mapping().addFileMapping(this._fileSystemPath,normalizedURLPrefix,normalizedPathPrefix);this._fileMappingsList.selectItem(normalizedURLPrefix);return true;},_normalizePrefix:function(prefix)
8890 {if(!prefix)
8891 return"";return prefix+(prefix[prefix.length-1]==="/"?"":"/");},_addMappingRow:function(entry)
8892 {var fileSystemPath=entry.fileSystemPath;var urlPrefix=entry.urlPrefix;if(!this._fileSystemPath||this._fileSystemPath!==fileSystemPath)
8893 return;this._entries[urlPrefix]=entry;var fileMappingListItem=this._fileMappingsList.addItem(urlPrefix,null);this._resize();},_excludedFolderAdded:function(event)
8894 {var entry=(event.data);this._addExcludedFolderRow(entry);},_excludedFolderRemoved:function(event)
8895 {var entry=(event.data);var fileSystemPath=entry.fileSystemPath;if(!fileSystemPath||this._fileSystemPath!==fileSystemPath)
8896 return;delete this._excludedFolderEntries[entry.path];if(this._excludedFolderList.itemForId(entry.path))
8897 this._excludedFolderList.removeItem(entry.path);},_excludedFolderValueProvider:function(itemId,columnId)
8898 {return itemId;},_excludedFolderValidate:function(itemId,data)
8899 {var fileSystemPath=this._fileSystemPath;var columns=[];if(!this._validateExcludedFolder(data["path"],itemId))
8900 columns.push("path");return columns;},_validateExcludedFolder:function(path,allowedPath)
8901 {return!!path&&(path===allowedPath||!this._excludedFolderEntries.contains(path));},_excludedFolderEdit:function(itemId,data)
8902 {var fileSystemPath=this._fileSystemPath;if(itemId)
8903 WebInspector.isolatedFileSystemManager.mapping().removeExcludedFolder(fileSystemPath,itemId);var excludedFolderPath=data["path"];WebInspector.isolatedFileSystemManager.mapping().addExcludedFolder(fileSystemPath,excludedFolderPath);},_excludedFolderRemovedfromList:function(event)
8904 {var itemId=(event.data);if(!itemId)
8905 return;WebInspector.isolatedFileSystemManager.mapping().removeExcludedFolder(this._fileSystemPath,itemId);},_addExcludedFolderRow:function(entry)
8906 {var fileSystemPath=entry.fileSystemPath;if(!fileSystemPath||this._fileSystemPath!==fileSystemPath)
8907 return;var path=entry.path;this._excludedFolderEntries.put(path,entry);this._excludedFolderList.addItem(path,null);},_checkURLPrefix:function(value,allowedPrefix)
8908 {var prefix=this._normalizePrefix(value);return!!prefix&&(prefix===allowedPrefix||!this._entries[prefix]);},_checkPathPrefix:function(value,allowedPrefix)
8909 {var prefix=this._normalizePrefix(value);if(!prefix)
8910 return false;if(prefix===allowedPrefix)
8911 return true;for(var urlPrefix in this._entries){var entry=this._entries[urlPrefix];if(urlPrefix&&entry.pathPrefix===prefix)
8912 return false;}
8913 return true;},focus:function()
8914 {WebInspector.setCurrentFocusElement(this.element);},_onDoneClick:function()
8915 {WebInspector.Dialog.hide();},onEnter:function()
8916 {},__proto__:WebInspector.DialogDelegate.prototype}
8917 WebInspector.ShortcutsScreen=function()
8918 {this._sections={};}
8919 WebInspector.ShortcutsScreen.prototype={section:function(name)
8920 {var section=this._sections[name];if(!section)
8921 this._sections[name]=section=new WebInspector.ShortcutsSection(name);return section;},createShortcutsTabView:function()
8922 {var orderedSections=[];for(var section in this._sections)
8923 orderedSections.push(this._sections[section]);function compareSections(a,b)
8924 {return a.order-b.order;}
8925 orderedSections.sort(compareSections);var view=new WebInspector.View();view.element.className="settings-tab-container";view.element.createChild("header").createChild("h3").appendChild(document.createTextNode(WebInspector.UIString("Shortcuts")));var scrollPane=view.element.createChild("div","help-container-wrapper");var container=scrollPane.createChild("div");container.className="help-content help-container";for(var i=0;i<orderedSections.length;++i)
8926 orderedSections[i].renderSection(container);var note=scrollPane.createChild("p","help-footnote");var noteLink=note.createChild("a");noteLink.href="https://developers.google.com/chrome-developer-tools/docs/shortcuts";noteLink.target="_blank";noteLink.createTextChild(WebInspector.UIString("Full list of keyboard shortcuts and gestures"));return view;}}
8927 WebInspector.shortcutsScreen;WebInspector.ShortcutsSection=function(name)
8928 {this.name=name;this._lines=([]);this.order=++WebInspector.ShortcutsSection._sequenceNumber;};WebInspector.ShortcutsSection._sequenceNumber=0;WebInspector.ShortcutsSection.prototype={addKey:function(key,description)
8929 {this._addLine(this._renderKey(key),description);},addRelatedKeys:function(keys,description)
8930 {this._addLine(this._renderSequence(keys,"/"),description);},addAlternateKeys:function(keys,description)
8931 {this._addLine(this._renderSequence(keys,WebInspector.UIString("or")),description);},_addLine:function(keyElement,description)
8932 {this._lines.push({key:keyElement,text:description})},renderSection:function(container)
8933 {var parent=container.createChild("div","help-block");var headLine=parent.createChild("div","help-line");headLine.createChild("div","help-key-cell");headLine.createChild("div","help-section-title help-cell").textContent=this.name;for(var i=0;i<this._lines.length;++i){var line=parent.createChild("div","help-line");var keyCell=line.createChild("div","help-key-cell");keyCell.appendChild(this._lines[i].key);keyCell.appendChild(this._createSpan("help-key-delimiter",":"));line.createChild("div","help-cell").textContent=this._lines[i].text;}},_renderSequence:function(sequence,delimiter)
8934 {var delimiterSpan=this._createSpan("help-key-delimiter",delimiter);return this._joinNodes(sequence.map(this._renderKey.bind(this)),delimiterSpan);},_renderKey:function(key)
8935 {var keyName=key.name;var plus=this._createSpan("help-combine-keys","+");return this._joinNodes(keyName.split(" + ").map(this._createSpan.bind(this,"help-key")),plus);},_createSpan:function(className,textContent)
8936 {var node=document.createElement("span");node.className=className;node.textContent=textContent;return node;},_joinNodes:function(nodes,delimiter)
8937 {var result=document.createDocumentFragment();for(var i=0;i<nodes.length;++i){if(i>0)
8938 result.appendChild(delimiter.cloneNode(true));result.appendChild(nodes[i]);}
8939 return result;}}
8940 WebInspector.ShortcutsScreen.registerShortcuts=function()
8941 {var elementsSection=WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));var navigate=WebInspector.ShortcutsScreen.ElementsPanelShortcuts.NavigateUp.concat(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.NavigateDown);elementsSection.addRelatedKeys(navigate,WebInspector.UIString("Navigate elements"));var expandCollapse=WebInspector.ShortcutsScreen.ElementsPanelShortcuts.Expand.concat(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.Collapse);elementsSection.addRelatedKeys(expandCollapse,WebInspector.UIString("Expand/collapse"));elementsSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.EditAttribute,WebInspector.UIString("Edit attribute"));elementsSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.HideElement,WebInspector.UIString("Hide element"));elementsSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.ToggleEditAsHTML,WebInspector.UIString("Toggle edit as HTML"));var stylesPaneSection=WebInspector.shortcutsScreen.section(WebInspector.UIString("Styles Pane"));var nextPreviousProperty=WebInspector.ShortcutsScreen.ElementsPanelShortcuts.NextProperty.concat(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.PreviousProperty);stylesPaneSection.addRelatedKeys(nextPreviousProperty,WebInspector.UIString("Next/previous property"));stylesPaneSection.addRelatedKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.IncrementValue,WebInspector.UIString("Increment value"));stylesPaneSection.addRelatedKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.DecrementValue,WebInspector.UIString("Decrement value"));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy10,WebInspector.UIString("Increment by %f",10));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy10,WebInspector.UIString("Decrement by %f",10));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy100,WebInspector.UIString("Increment by %f",100));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy100,WebInspector.UIString("Decrement by %f",100));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy01,WebInspector.UIString("Increment by %f",0.1));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy01,WebInspector.UIString("Decrement by %f",0.1));var section=WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.PauseContinue,WebInspector.UIString("Pause/Continue"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepOver,WebInspector.UIString("Step over"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepInto,WebInspector.UIString("Step into"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepIntoSelection,WebInspector.UIString("Step into selection"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepOut,WebInspector.UIString("Step out"));var nextAndPrevFrameKeys=WebInspector.ShortcutsScreen.SourcesPanelShortcuts.NextCallFrame.concat(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.PrevCallFrame);section.addRelatedKeys(nextAndPrevFrameKeys,WebInspector.UIString("Next/previous call frame"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.EvaluateSelectionInConsole,WebInspector.UIString("Evaluate selection in console"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.AddSelectionToWatch,WebInspector.UIString("Add selection to watch"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.GoToMember,WebInspector.UIString("Go to member"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.ToggleBreakpoint,WebInspector.UIString("Toggle breakpoint"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.ToggleComment,WebInspector.UIString("Toggle comment"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.IncreaseCSSUnitByOne,WebInspector.UIString("Increment CSS unit by 1"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.DecreaseCSSUnitByOne,WebInspector.UIString("Decrement CSS unit by 1"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.IncreaseCSSUnitByTen,WebInspector.UIString("Increment CSS unit by 10"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.DecreaseCSSUnitByTen,WebInspector.UIString("Decrement CSS unit by 10"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.JumpToPreviousLocation,WebInspector.UIString("Jump to previous editing location"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.JumpToNextLocation,WebInspector.UIString("Jump to next editing location"));section=WebInspector.shortcutsScreen.section(WebInspector.UIString("Timeline Panel"));section.addAlternateKeys(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.StartStopRecording,WebInspector.UIString("Start/stop recording"));section.addAlternateKeys(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.SaveToFile,WebInspector.UIString("Save timeline data"));section.addAlternateKeys(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.LoadFromFile,WebInspector.UIString("Load timeline data"));section=WebInspector.shortcutsScreen.section(WebInspector.UIString("Profiles Panel"));section.addAlternateKeys(WebInspector.ShortcutsScreen.ProfilesPanelShortcuts.StartStopRecording,WebInspector.UIString("Start/stop recording"));}
8942 WebInspector.ShortcutsScreen.ElementsPanelShortcuts={NavigateUp:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up)],NavigateDown:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down)],Expand:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Right)],Collapse:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Left)],EditAttribute:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Enter)],HideElement:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.H)],ToggleEditAsHTML:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F2)],NextProperty:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Tab)],PreviousProperty:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Tab,WebInspector.KeyboardShortcut.Modifiers.Shift)],IncrementValue:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up)],DecrementValue:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down)],IncrementBy10:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up,WebInspector.KeyboardShortcut.Modifiers.Shift)],DecrementBy10:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down,WebInspector.KeyboardShortcut.Modifiers.Shift)],IncrementBy100:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp,WebInspector.KeyboardShortcut.Modifiers.Shift)],DecrementBy100:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown,WebInspector.KeyboardShortcut.Modifiers.Shift)],IncrementBy01:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp,WebInspector.KeyboardShortcut.Modifiers.Alt)],DecrementBy01:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown,WebInspector.KeyboardShortcut.Modifiers.Alt)]};WebInspector.ShortcutsScreen.SourcesPanelShortcuts={IncreaseCSSUnitByOne:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up,WebInspector.KeyboardShortcut.Modifiers.Alt)],DecreaseCSSUnitByOne:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down,WebInspector.KeyboardShortcut.Modifiers.Alt)],IncreaseCSSUnitByTen:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp,WebInspector.KeyboardShortcut.Modifiers.Alt)],DecreaseCSSUnitByTen:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown,WebInspector.KeyboardShortcut.Modifiers.Alt)],RunSnippet:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Enter,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],PauseContinue:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Backslash,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],StepOver:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],StepInto:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],StepIntoSelection:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11,WebInspector.KeyboardShortcut.Modifiers.Shift|WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],StepOut:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11,WebInspector.KeyboardShortcut.Modifiers.Shift),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon,WebInspector.KeyboardShortcut.Modifiers.Shift|WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],EvaluateSelectionInConsole:[WebInspector.KeyboardShortcut.makeDescriptor("e",WebInspector.KeyboardShortcut.Modifiers.Shift|WebInspector.KeyboardShortcut.Modifiers.Ctrl)],AddSelectionToWatch:[WebInspector.KeyboardShortcut.makeDescriptor("a",WebInspector.KeyboardShortcut.Modifiers.Shift|WebInspector.KeyboardShortcut.Modifiers.Ctrl)],GoToMember:[WebInspector.KeyboardShortcut.makeDescriptor("o",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta|WebInspector.KeyboardShortcut.Modifiers.Shift)],ToggleBreakpoint:[WebInspector.KeyboardShortcut.makeDescriptor("b",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],NextCallFrame:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Period,WebInspector.KeyboardShortcut.Modifiers.Ctrl)],PrevCallFrame:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Comma,WebInspector.KeyboardShortcut.Modifiers.Ctrl)],ToggleComment:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],JumpToPreviousLocation:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Minus,WebInspector.KeyboardShortcut.Modifiers.Alt)],JumpToNextLocation:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Plus,WebInspector.KeyboardShortcut.Modifiers.Alt)]};WebInspector.ShortcutsScreen.TimelinePanelShortcuts={StartStopRecording:[WebInspector.KeyboardShortcut.makeDescriptor("e",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],SaveToFile:[WebInspector.KeyboardShortcut.makeDescriptor("s",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],LoadFromFile:[WebInspector.KeyboardShortcut.makeDescriptor("o",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)]};WebInspector.ShortcutsScreen.ProfilesPanelShortcuts={StartStopRecording:[WebInspector.KeyboardShortcut.makeDescriptor("e",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)]}
8943 WebInspector.HAREntry=function(request)
8944 {this._request=request;}
8945 WebInspector.HAREntry.prototype={build:function()
8946 {var entry={startedDateTime:new Date(this._request.startTime*1000),time:this._request.timing?WebInspector.HAREntry._toMilliseconds(this._request.duration):0,request:this._buildRequest(),response:this._buildResponse(),cache:{},timings:this._buildTimings()};if(this._request.connectionId)
8947 entry.connection=String(this._request.connectionId);var page=WebInspector.networkLog.pageLoadForRequest(this._request);if(page)
8948 entry.pageref="page_"+page.id;return entry;},_buildRequest:function()
8949 {var headersText=this._request.requestHeadersText();var res={method:this._request.requestMethod,url:this._buildRequestURL(this._request.url),httpVersion:this._request.requestHttpVersion(),headers:this._request.requestHeaders(),queryString:this._buildParameters(this._request.queryParameters||[]),cookies:this._buildCookies(this._request.requestCookies||[]),headersSize:headersText?headersText.length:-1,bodySize:this.requestBodySize};if(this._request.requestFormData)
8950 res.postData=this._buildPostData();return res;},_buildResponse:function()
8951 {return{status:this._request.statusCode,statusText:this._request.statusText,httpVersion:this._request.responseHttpVersion,headers:this._request.responseHeaders,cookies:this._buildCookies(this._request.responseCookies||[]),content:this._buildContent(),redirectURL:this._request.responseHeaderValue("Location")||"",headersSize:this._request.responseHeadersSize,bodySize:this.responseBodySize};},_buildContent:function()
8952 {var content={size:this._request.resourceSize,mimeType:this._request.mimeType,};var compression=this.responseCompression;if(typeof compression==="number")
8953 content.compression=compression;return content;},_buildTimings:function()
8954 {var timing=this._request.timing;if(!timing)
8955 return{blocked:-1,dns:-1,connect:-1,send:0,wait:0,receive:0,ssl:-1};function firstNonNegative(values)
8956 {for(var i=0;i<values.length;++i){if(values[i]>=0)
8957 return values[i];}
8958 console.assert(false,"Incomplete requet timing information.");}
8959 var blocked=firstNonNegative([timing.dnsStart,timing.connectStart,timing.sendStart]);var dns=-1;if(timing.dnsStart>=0)
8960 dns=firstNonNegative([timing.connectStart,timing.sendStart])-timing.dnsStart;var connect=-1;if(timing.connectStart>=0)
8961 connect=timing.sendStart-timing.connectStart;var send=timing.sendEnd-timing.sendStart;var wait=timing.receiveHeadersEnd-timing.sendEnd;var receive=WebInspector.HAREntry._toMilliseconds(this._request.duration)-timing.receiveHeadersEnd;var ssl=-1;if(timing.sslStart>=0&&timing.sslEnd>=0)
8962 ssl=timing.sslEnd-timing.sslStart;return{blocked:blocked,dns:dns,connect:connect,send:send,wait:wait,receive:receive,ssl:ssl};},_buildPostData:function()
8963 {var res={mimeType:this._request.requestContentType(),text:this._request.requestFormData};if(this._request.formParameters)
8964 res.params=this._buildParameters(this._request.formParameters);return res;},_buildParameters:function(parameters)
8965 {return parameters.slice();},_buildRequestURL:function(url)
8966 {return url.split("#",2)[0];},_buildCookies:function(cookies)
8967 {return cookies.map(this._buildCookie.bind(this));},_buildCookie:function(cookie)
8968 {return{name:cookie.name(),value:cookie.value(),path:cookie.path(),domain:cookie.domain(),expires:cookie.expiresDate(new Date(this._request.startTime*1000)),httpOnly:cookie.httpOnly(),secure:cookie.secure()};},get requestBodySize()
8969 {return!this._request.requestFormData?0:this._request.requestFormData.length;},get responseBodySize()
8970 {if(this._request.cached||this._request.statusCode===304)
8971 return 0;return this._request.transferSize-this._request.responseHeadersSize;},get responseCompression()
8972 {if(this._request.cached||this._request.statusCode===304||this._request.statusCode===206)
8973 return;return this._request.resourceSize-this.responseBodySize;}}
8974 WebInspector.HAREntry._toMilliseconds=function(time)
8975 {return time===-1?-1:time*1000;}
8976 WebInspector.HARLog=function(requests)
8977 {this._requests=requests;}
8978 WebInspector.HARLog.prototype={build:function()
8979 {return{version:"1.2",creator:this._creator(),pages:this._buildPages(),entries:this._requests.map(this._convertResource.bind(this))}},_creator:function()
8980 {var webKitVersion=/AppleWebKit\/([^ ]+)/.exec(window.navigator.userAgent);return{name:"WebInspector",version:webKitVersion?webKitVersion[1]:"n/a"};},_buildPages:function()
8981 {var seenIdentifiers={};var pages=[];for(var i=0;i<this._requests.length;++i){var page=WebInspector.networkLog.pageLoadForRequest(this._requests[i]);if(!page||seenIdentifiers[page.id])
8982 continue;seenIdentifiers[page.id]=true;pages.push(this._convertPage(page));}
8983 return pages;},_convertPage:function(page)
8984 {return{startedDateTime:new Date(page.startTime*1000),id:"page_"+page.id,title:page.url,pageTimings:{onContentLoad:this._pageEventTime(page,page.contentLoadTime),onLoad:this._pageEventTime(page,page.loadTime)}}},_convertResource:function(request)
8985 {return(new WebInspector.HAREntry(request)).build();},_pageEventTime:function(page,time)
8986 {var startTime=page.startTime;if(time===-1||startTime===-1)
8987 return-1;return WebInspector.HAREntry._toMilliseconds(time-startTime);}}
8988 WebInspector.HARWriter=function()
8989 {}
8990 WebInspector.HARWriter.prototype={write:function(stream,requests,progress)
8991 {this._stream=stream;this._harLog=(new WebInspector.HARLog(requests)).build();this._pendingRequests=1;var entries=this._harLog.entries;for(var i=0;i<entries.length;++i){var content=requests[i].content;if(typeof content==="undefined"&&requests[i].finished){++this._pendingRequests;requests[i].requestContent(this._onContentAvailable.bind(this,entries[i]));}else if(content!==null)
8992 entries[i].response.content.text=content;}
8993 var compositeProgress=new WebInspector.CompositeProgress(progress);this._writeProgress=compositeProgress.createSubProgress();if(--this._pendingRequests){this._requestsProgress=compositeProgress.createSubProgress();this._requestsProgress.setTitle(WebInspector.UIString("Collecting content…"));this._requestsProgress.setTotalWork(this._pendingRequests);}else
8994 this._beginWrite();},_onContentAvailable:function(entry,content)
8995 {if(content!==null)
8996 entry.response.content.text=content;if(this._requestsProgress)
8997 this._requestsProgress.worked();if(!--this._pendingRequests){this._requestsProgress.done();this._beginWrite();}},_beginWrite:function()
8998 {const jsonIndent=2;this._text=JSON.stringify({log:this._harLog},null,jsonIndent);this._writeProgress.setTitle(WebInspector.UIString("Writing file…"));this._writeProgress.setTotalWork(this._text.length);this._bytesWritten=0;this._writeNextChunk(this._stream);},_writeNextChunk:function(stream,error)
8999 {if(this._bytesWritten>=this._text.length||error){stream.close();this._writeProgress.done();return;}
9000 const chunkSize=100000;var text=this._text.substring(this._bytesWritten,this._bytesWritten+chunkSize);this._bytesWritten+=text.length;stream.write(text,this._writeNextChunk.bind(this));this._writeProgress.setWorked(this._bytesWritten);}}
9001 WebInspector.CookieParser=function()
9002 {}
9003 WebInspector.CookieParser.KeyValue=function(key,value,position)
9004 {this.key=key;this.value=value;this.position=position;}
9005 WebInspector.CookieParser.prototype={cookies:function()
9006 {return this._cookies;},parseCookie:function(cookieHeader)
9007 {if(!this._initialize(cookieHeader))
9008 return null;for(var kv=this._extractKeyValue();kv;kv=this._extractKeyValue()){if(kv.key.charAt(0)==="$"&&this._lastCookie)
9009 this._lastCookie.addAttribute(kv.key.slice(1),kv.value);else if(kv.key.toLowerCase()!=="$version"&&typeof kv.value==="string")
9010 this._addCookie(kv,WebInspector.Cookie.Type.Request);this._advanceAndCheckCookieDelimiter();}
9011 this._flushCookie();return this._cookies;},parseSetCookie:function(setCookieHeader)
9012 {if(!this._initialize(setCookieHeader))
9013 return null;for(var kv=this._extractKeyValue();kv;kv=this._extractKeyValue()){if(this._lastCookie)
9014 this._lastCookie.addAttribute(kv.key,kv.value);else
9015 this._addCookie(kv,WebInspector.Cookie.Type.Response);if(this._advanceAndCheckCookieDelimiter())
9016 this._flushCookie();}
9017 this._flushCookie();return this._cookies;},_initialize:function(headerValue)
9018 {this._input=headerValue;if(typeof headerValue!=="string")
9019 return false;this._cookies=[];this._lastCookie=null;this._originalInputLength=this._input.length;return true;},_flushCookie:function()
9020 {if(this._lastCookie)
9021 this._lastCookie.setSize(this._originalInputLength-this._input.length-this._lastCookiePosition);this._lastCookie=null;},_extractKeyValue:function()
9022 {if(!this._input||!this._input.length)
9023 return null;var keyValueMatch=/^[ \t]*([^\s=;]+)[ \t]*(?:=[ \t]*([^;\n]*))?/.exec(this._input);if(!keyValueMatch){console.log("Failed parsing cookie header before: "+this._input);return null;}
9024 var result=new WebInspector.CookieParser.KeyValue(keyValueMatch[1],keyValueMatch[2]&&keyValueMatch[2].trim(),this._originalInputLength-this._input.length);this._input=this._input.slice(keyValueMatch[0].length);return result;},_advanceAndCheckCookieDelimiter:function()
9025 {var match=/^\s*[\n;]\s*/.exec(this._input);if(!match)
9026 return false;this._input=this._input.slice(match[0].length);return match[0].match("\n")!==null;},_addCookie:function(keyValue,type)
9027 {if(this._lastCookie)
9028 this._lastCookie.setSize(keyValue.position-this._lastCookiePosition);this._lastCookie=typeof keyValue.value==="string"?new WebInspector.Cookie(keyValue.key,keyValue.value,type):new WebInspector.Cookie("",keyValue.key,type);this._lastCookiePosition=keyValue.position;this._cookies.push(this._lastCookie);}};WebInspector.CookieParser.parseCookie=function(header)
9029 {return(new WebInspector.CookieParser()).parseCookie(header);}
9030 WebInspector.CookieParser.parseSetCookie=function(header)
9031 {return(new WebInspector.CookieParser()).parseSetCookie(header);}
9032 WebInspector.Cookie=function(name,value,type)
9033 {this._name=name;this._value=value;this._type=type;this._attributes={};}
9034 WebInspector.Cookie.prototype={name:function()
9035 {return this._name;},value:function()
9036 {return this._value;},type:function()
9037 {return this._type;},httpOnly:function()
9038 {return"httponly"in this._attributes;},secure:function()
9039 {return"secure"in this._attributes;},session:function()
9040 {return!("expires"in this._attributes||"max-age"in this._attributes);},path:function()
9041 {return this._attributes["path"];},port:function()
9042 {return this._attributes["port"];},domain:function()
9043 {return this._attributes["domain"];},expires:function()
9044 {return this._attributes["expires"];},maxAge:function()
9045 {return this._attributes["max-age"];},size:function()
9046 {return this._size;},setSize:function(size)
9047 {this._size=size;},expiresDate:function(requestDate)
9048 {if(this.maxAge()){var targetDate=requestDate===null?new Date():requestDate;return new Date(targetDate.getTime()+1000*this.maxAge());}
9049 if(this.expires())
9050 return new Date(this.expires());return null;},attributes:function()
9051 {return this._attributes;},addAttribute:function(key,value)
9052 {this._attributes[key.toLowerCase()]=value;},remove:function(callback)
9053 {PageAgent.deleteCookie(this.name(),(this.secure()?"https://":"http://")+this.domain()+this.path(),callback);}}
9054 WebInspector.Cookie.Type={Request:0,Response:1};WebInspector.Cookies={}
9055 WebInspector.Cookies.getCookiesAsync=function(callback)
9056 {function mycallback(error,cookies)
9057 {if(error)
9058 return;callback(cookies.map(WebInspector.Cookies.buildCookieProtocolObject));}
9059 PageAgent.getCookies(mycallback);}
9060 WebInspector.Cookies.buildCookieProtocolObject=function(protocolCookie)
9061 {var cookie=new WebInspector.Cookie(protocolCookie.name,protocolCookie.value,null);cookie.addAttribute("domain",protocolCookie["domain"]);cookie.addAttribute("path",protocolCookie["path"]);cookie.addAttribute("port",protocolCookie["port"]);if(protocolCookie["expires"])
9062 cookie.addAttribute("expires",protocolCookie["expires"]);if(protocolCookie["httpOnly"])
9063 cookie.addAttribute("httpOnly");if(protocolCookie["secure"])
9064 cookie.addAttribute("secure");cookie.setSize(protocolCookie["size"]);return cookie;}
9065 WebInspector.Cookies.cookieMatchesResourceURL=function(cookie,resourceURL)
9066 {var url=resourceURL.asParsedURL();if(!url||!WebInspector.Cookies.cookieDomainMatchesResourceDomain(cookie.domain(),url.host))
9067 return false;return(url.path.startsWith(cookie.path())&&(!cookie.port()||url.port==cookie.port())&&(!cookie.secure()||url.scheme==="https"));}
9068 WebInspector.Cookies.cookieDomainMatchesResourceDomain=function(cookieDomain,resourceDomain)
9069 {if(cookieDomain.charAt(0)!=='.')
9070 return resourceDomain===cookieDomain;return!!resourceDomain.match(new RegExp("^([^\\.]+\\.)*"+cookieDomain.substring(1).escapeForRegExp()+"$","i"));}
9071 WebInspector.SearchableView=function(searchable)
9072 {WebInspector.View.call(this);this._searchProvider=searchable;this.element.classList.add("vbox");this.element.style.flex="auto";this.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this._footerElementContainer=this.element.createChild("div","inspector-footer status-bar hidden");this._footerElementContainer.style.order=100;this._footerElement=this._footerElementContainer.createChild("table","toolbar-search");this._footerElement.cellSpacing=0;this._firstRowElement=this._footerElement.createChild("tr");this._secondRowElement=this._footerElement.createChild("tr","hidden");var searchControlElementColumn=this._firstRowElement.createChild("td");this._searchControlElement=searchControlElementColumn.createChild("span","toolbar-search-control");this._searchInputElement=this._searchControlElement.createChild("input","search-replace");this._searchInputElement.id="search-input-field";this._searchInputElement.placeholder=WebInspector.UIString("Find");this._matchesElement=this._searchControlElement.createChild("label","search-results-matches");this._matchesElement.setAttribute("for","search-input-field");this._searchNavigationElement=this._searchControlElement.createChild("div","toolbar-search-navigation-controls");this._searchNavigationPrevElement=this._searchNavigationElement.createChild("div","toolbar-search-navigation toolbar-search-navigation-prev");this._searchNavigationPrevElement.addEventListener("click",this._onPrevButtonSearch.bind(this),false);this._searchNavigationPrevElement.title=WebInspector.UIString("Search Previous");this._searchNavigationNextElement=this._searchNavigationElement.createChild("div","toolbar-search-navigation toolbar-search-navigation-next");this._searchNavigationNextElement.addEventListener("click",this._onNextButtonSearch.bind(this),false);this._searchNavigationNextElement.title=WebInspector.UIString("Search Next");this._searchInputElement.addEventListener("mousedown",this._onSearchFieldManualFocus.bind(this),false);this._searchInputElement.addEventListener("keydown",this._onSearchKeyDown.bind(this),true);this._searchInputElement.addEventListener("input",this._onInput.bind(this),false);this._replaceInputElement=this._secondRowElement.createChild("td").createChild("input","search-replace toolbar-replace-control");this._replaceInputElement.addEventListener("keydown",this._onReplaceKeyDown.bind(this),true);this._replaceInputElement.placeholder=WebInspector.UIString("Replace");this._findButtonElement=this._firstRowElement.createChild("td").createChild("button","hidden");this._findButtonElement.textContent=WebInspector.UIString("Find");this._findButtonElement.tabIndex=-1;this._findButtonElement.addEventListener("click",this._onNextButtonSearch.bind(this),false);this._replaceButtonElement=this._secondRowElement.createChild("td").createChild("button");this._replaceButtonElement.textContent=WebInspector.UIString("Replace");this._replaceButtonElement.disabled=true;this._replaceButtonElement.tabIndex=-1;this._replaceButtonElement.addEventListener("click",this._replace.bind(this),false);this._prevButtonElement=this._firstRowElement.createChild("td").createChild("button","hidden");this._prevButtonElement.textContent=WebInspector.UIString("Previous");this._prevButtonElement.disabled=true;this._prevButtonElement.tabIndex=-1;this._prevButtonElement.addEventListener("click",this._onPrevButtonSearch.bind(this),false);this._replaceAllButtonElement=this._secondRowElement.createChild("td").createChild("button");this._replaceAllButtonElement.textContent=WebInspector.UIString("Replace All");this._replaceAllButtonElement.addEventListener("click",this._replaceAll.bind(this),false);this._replaceElement=this._firstRowElement.createChild("td").createChild("span");this._replaceCheckboxElement=this._replaceElement.createChild("input");this._replaceCheckboxElement.type="checkbox";this._replaceCheckboxElement.id="search-replace-trigger";this._replaceCheckboxElement.addEventListener("change",this._updateSecondRowVisibility.bind(this),false);this._replaceLabelElement=this._replaceElement.createChild("label");this._replaceLabelElement.textContent=WebInspector.UIString("Replace");this._replaceLabelElement.setAttribute("for","search-replace-trigger");var cancelButtonElement=this._firstRowElement.createChild("td").createChild("button");cancelButtonElement.textContent=WebInspector.UIString("Cancel");cancelButtonElement.tabIndex=-1;cancelButtonElement.addEventListener("click",this.closeSearch.bind(this),false);this._minimalSearchQuerySize=3;this._registerShortcuts();}
9073 WebInspector.SearchableView.findShortcuts=function()
9074 {if(WebInspector.SearchableView._findShortcuts)
9075 return WebInspector.SearchableView._findShortcuts;WebInspector.SearchableView._findShortcuts=[WebInspector.KeyboardShortcut.makeDescriptor("f",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)];if(!WebInspector.isMac())
9076 WebInspector.SearchableView._findShortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F3));return WebInspector.SearchableView._findShortcuts;}
9077 WebInspector.SearchableView.cancelSearchShortcuts=function()
9078 {if(WebInspector.SearchableView._cancelSearchShortcuts)
9079 return WebInspector.SearchableView._cancelSearchShortcuts;WebInspector.SearchableView._cancelSearchShortcuts=[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Esc)];return WebInspector.SearchableView._cancelSearchShortcuts;}
9080 WebInspector.SearchableView.findNextShortcut=function()
9081 {if(WebInspector.SearchableView._findNextShortcut)
9082 return WebInspector.SearchableView._findNextShortcut;WebInspector.SearchableView._findNextShortcut=[];if(!WebInspector.isMac())
9083 WebInspector.SearchableView._findNextShortcut.push(WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta));return WebInspector.SearchableView._findNextShortcut;}
9084 WebInspector.SearchableView.findPreviousShortcuts=function()
9085 {if(WebInspector.SearchableView._findPreviousShortcuts)
9086 return WebInspector.SearchableView._findPreviousShortcuts;WebInspector.SearchableView._findPreviousShortcuts=[];if(!WebInspector.isMac())
9087 WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta|WebInspector.KeyboardShortcut.Modifiers.Shift));return WebInspector.SearchableView._findPreviousShortcuts;}
9088 WebInspector.SearchableView.prototype={_onKeyDown:function(event)
9089 {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcutKey];if(handler&&handler(event))
9090 event.consume(true);},_registerShortcuts:function()
9091 {this._shortcuts={};function register(shortcuts,handler)
9092 {for(var i=0;i<shortcuts.length;++i)
9093 this._shortcuts[shortcuts[i].key]=handler;}
9094 register.call(this,WebInspector.SearchableView.findShortcuts(),this.handleFindShortcut.bind(this));register.call(this,WebInspector.SearchableView.cancelSearchShortcuts(),this.handleCancelSearchShortcut.bind(this));register.call(this,WebInspector.SearchableView.findNextShortcut(),this.handleFindNextShortcut.bind(this));register.call(this,WebInspector.SearchableView.findPreviousShortcuts(),this.handleFindPreviousShortcut.bind(this));},setMinimalSearchQuerySize:function(minimalSearchQuerySize)
9095 {this._minimalSearchQuerySize=minimalSearchQuerySize;},setReplaceable:function(replaceable)
9096 {this._replaceable=replaceable;},updateSearchMatchesCount:function(matches)
9097 {this._searchProvider.currentSearchMatches=matches;this._updateSearchMatchesCountAndCurrentMatchIndex(this._searchProvider.currentQuery?matches:0,-1);},updateCurrentMatchIndex:function(currentMatchIndex)
9098 {this._updateSearchMatchesCountAndCurrentMatchIndex(this._searchProvider.currentSearchMatches,currentMatchIndex);},isSearchVisible:function()
9099 {return this._searchIsVisible;},closeSearch:function()
9100 {this.cancelSearch();WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement());},_toggleSearchBar:function(toggled)
9101 {this._footerElementContainer.enableStyleClass("hidden",!toggled);this.doResize();},cancelSearch:function()
9102 {if(!this._searchIsVisible)
9103 return;this.resetSearch();delete this._searchIsVisible;this._toggleSearchBar(false);},resetSearch:function()
9104 {this._clearSearch();this._updateReplaceVisibility();this._matchesElement.textContent="";},handleFindNextShortcut:function()
9105 {if(!this._searchIsVisible)
9106 return false;this._searchProvider.jumpToNextSearchResult();return true;},handleFindPreviousShortcut:function()
9107 {if(!this._searchIsVisible)
9108 return false;this._searchProvider.jumpToPreviousSearchResult();return true;},handleFindShortcut:function()
9109 {this.showSearchField();return true;},handleCancelSearchShortcut:function()
9110 {if(!this._searchIsVisible)
9111 return false;this.closeSearch();return true;},_updateSearchNavigationButtonState:function(enabled)
9112 {this._replaceButtonElement.disabled=!enabled;this._prevButtonElement.disabled=!enabled;if(enabled){this._searchNavigationPrevElement.classList.add("enabled");this._searchNavigationNextElement.classList.add("enabled");}else{this._searchNavigationPrevElement.classList.remove("enabled");this._searchNavigationNextElement.classList.remove("enabled");}},_updateSearchMatchesCountAndCurrentMatchIndex:function(matches,currentMatchIndex)
9113 {if(!this._currentQuery)
9114 this._matchesElement.textContent="";else if(matches===0||currentMatchIndex>=0)
9115 this._matchesElement.textContent=WebInspector.UIString("%d of %d",currentMatchIndex+1,matches);else if(matches===1)
9116 this._matchesElement.textContent=WebInspector.UIString("1 match");else
9117 this._matchesElement.textContent=WebInspector.UIString("%d matches",matches);this._updateSearchNavigationButtonState(matches>0);},showSearchField:function()
9118 {if(this._searchIsVisible)
9119 this.cancelSearch();this._toggleSearchBar(true);this._updateReplaceVisibility();if(WebInspector.currentFocusElement()!==this._searchInputElement){var selection=window.getSelection();if(selection.rangeCount){var queryCandidate=selection.toString().replace(/\r?\n.*/,"");if(queryCandidate)
9120 this._searchInputElement.value=queryCandidate;}}
9121 this._performSearch(false,false);this._searchInputElement.focus();this._searchInputElement.select();this._searchIsVisible=true;},_updateReplaceVisibility:function()
9122 {this._replaceElement.enableStyleClass("hidden",!this._replaceable);if(!this._replaceable){this._replaceCheckboxElement.checked=false;this._updateSecondRowVisibility();}},_onSearchFieldManualFocus:function(event)
9123 {WebInspector.setCurrentFocusElement(event.target);},_onSearchKeyDown:function(event)
9124 {if(isEnterKey(event)){if(!this._currentQuery)
9125 this._performSearch(true,true);else
9126 this._jumpToNextSearchResult(event.shiftKey);}},_onReplaceKeyDown:function(event)
9127 {if(isEnterKey(event))
9128 this._replace();},_jumpToNextSearchResult:function(isBackwardSearch)
9129 {if(!this._currentQuery||!this._searchNavigationPrevElement.classList.contains("enabled"))
9130 return;if(isBackwardSearch)
9131 this._searchProvider.jumpToPreviousSearchResult();else
9132 this._searchProvider.jumpToNextSearchResult();},_onNextButtonSearch:function(event)
9133 {if(!this._searchNavigationNextElement.classList.contains("enabled"))
9134 return;this._jumpToNextSearchResult();this._searchInputElement.focus();},_onPrevButtonSearch:function(event)
9135 {if(!this._searchNavigationPrevElement.classList.contains("enabled"))
9136 return;this._jumpToNextSearchResult(true);this._searchInputElement.focus();},_clearSearch:function()
9137 {delete this._currentQuery;if(!!this._searchProvider.currentQuery){delete this._searchProvider.currentQuery;this._searchProvider.searchCanceled();}
9138 this._updateSearchMatchesCountAndCurrentMatchIndex(0,-1);},_performSearch:function(forceSearch,shouldJump)
9139 {var query=this._searchInputElement.value;if(!query||(!forceSearch&&query.length<this._minimalSearchQuerySize&&!this._currentQuery)){this._clearSearch();return;}
9140 this._currentQuery=query;this._searchProvider.currentQuery=query;this._searchProvider.performSearch(query,shouldJump);},_updateSecondRowVisibility:function()
9141 {if(this._replaceCheckboxElement.checked){this._footerElement.classList.add("toolbar-search-replace");this._secondRowElement.classList.remove("hidden");this._prevButtonElement.classList.remove("hidden");this._findButtonElement.classList.remove("hidden");this._replaceCheckboxElement.tabIndex=-1;this._replaceInputElement.focus();}else{this._footerElement.classList.remove("toolbar-search-replace");this._secondRowElement.classList.add("hidden");this._prevButtonElement.classList.add("hidden");this._findButtonElement.classList.add("hidden");this._replaceCheckboxElement.tabIndex=0;this._searchInputElement.focus();}
9142 this.doResize();},_replace:function()
9143 {(this._searchProvider).replaceSelectionWith(this._replaceInputElement.value);delete this._currentQuery;this._performSearch(true,true);},_replaceAll:function()
9144 {(this._searchProvider).replaceAllWith(this._searchInputElement.value,this._replaceInputElement.value);},_onInput:function(event)
9145 {this._onValueChanged();},_onValueChanged:function()
9146 {this._performSearch(false,true);},__proto__:WebInspector.View.prototype}
9147 WebInspector.Searchable=function()
9148 {}
9149 WebInspector.Searchable.prototype={searchCanceled:function(){},performSearch:function(query,shouldJump){},jumpToNextSearchResult:function(){},jumpToPreviousSearchResult:function(){}}
9150 WebInspector.Replaceable=function()
9151 {}
9152 WebInspector.Replaceable.prototype={replaceSelectionWith:function(text){},replaceAllWith:function(query,replacement){}}
9153 WebInspector.FilterBar=function()
9154 {this._filtersShown=false;this._element=document.createElement("div");this._element.className="hbox";this._filterButton=new WebInspector.StatusBarButton(WebInspector.UIString("Filter"),"filters-toggle",3);this._filterButton.element.addEventListener("mousedown",this._handleFilterButtonClick.bind(this),false);this._filters=[];}
9155 WebInspector.FilterBar.Events={FiltersToggled:"FiltersToggled"}
9156 WebInspector.FilterBar.FilterBarState={Inactive:"inactive",Active:"active",Shown:"shown"};WebInspector.FilterBar.prototype={filterButton:function()
9157 {return this._filterButton;},filtersElement:function()
9158 {return this._element;},filtersToggled:function()
9159 {return this._filtersShown;},addFilter:function(filter)
9160 {this._filters.push(filter);this._element.appendChild(filter.element());filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._filterChanged,this);this._updateFilterButton();},_filterChanged:function(event)
9161 {this._updateFilterButton();},_filterBarState:function()
9162 {if(this._filtersShown)
9163 return WebInspector.FilterBar.FilterBarState.Shown;var isActive=false;for(var i=0;i<this._filters.length;++i){if(this._filters[i].isActive())
9164 return WebInspector.FilterBar.FilterBarState.Active;}
9165 return WebInspector.FilterBar.FilterBarState.Inactive;},_updateFilterButton:function()
9166 {this._filterButton.state=this._filterBarState();},_handleFilterButtonClick:function(event)
9167 {this._filtersShown=!this._filtersShown;this._updateFilterButton();this.dispatchEventToListeners(WebInspector.FilterBar.Events.FiltersToggled,this._filtersShown);},clear:function()
9168 {this._element.removeChildren();this._filters=[];this._updateFilterButton();},__proto__:WebInspector.Object.prototype}
9169 WebInspector.FilterUI=function()
9170 {}
9171 WebInspector.FilterUI.Events={FilterChanged:"FilterChanged"}
9172 WebInspector.FilterUI.prototype={isActive:function(){},element:function(){}}
9173 WebInspector.TextFilterUI=function(supportRegex)
9174 {this._supportRegex=!!supportRegex;this._regex=null;this._filterElement=document.createElement("div");this._filterElement.className="filter-text-filter";this._filterInputElement=this._filterElement.createChild("input","search-replace toolbar-replace-control");this._filterInputElement.placeholder=WebInspector.UIString("Filter");this._filterInputElement.id="filter-input-field";this._filterInputElement.addEventListener("mousedown",this._onFilterFieldManualFocus.bind(this),false);this._filterInputElement.addEventListener("input",this._onInput.bind(this),false);this._filterInputElement.addEventListener("change",this._onInput.bind(this),false);if(this._supportRegex){this._filterElement.classList.add("supports-regex");this._regexCheckBox=this._filterElement.createChild("input");this._regexCheckBox.type="checkbox";this._regexCheckBox.id="text-filter-regex";this._regexCheckBox.addEventListener("change",this._onInput.bind(this),false);this._regexLabel=this._filterElement.createChild("label");this._regexLabel.htmlFor="text-filter-regex";this._regexLabel.textContent=WebInspector.UIString("Regex");}}
9175 WebInspector.TextFilterUI.prototype={isActive:function()
9176 {return!!this._filterInputElement.value;},element:function()
9177 {return this._filterElement;},value:function()
9178 {return this._filterInputElement.value;},setValue:function(value)
9179 {this._filterInputElement.value=value;this._valueChanged();},regex:function()
9180 {return this._regex;},_onFilterFieldManualFocus:function(event)
9181 {WebInspector.setCurrentFocusElement(event.target);},_onInput:function(event)
9182 {this._valueChanged();},_valueChanged:function(){var filterQuery=this.value();this._regex=null;this._filterInputElement.classList.remove("filter-text-invalid");if(filterQuery){if(this._supportRegex&&this._regexCheckBox.checked){try{this._regex=new RegExp(filterQuery,"i");}catch(e){this._filterInputElement.classList.add("filter-text-invalid");}}else{this._regex=createPlainTextSearchRegex(filterQuery,"i");}}
9183 this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},__proto__:WebInspector.Object.prototype}
9184 WebInspector.NamedBitSetFilterUI=function()
9185 {this._filtersElement=document.createElement("div");this._filtersElement.className="filter-bitset-filter status-bar-item";this._filtersElement.title=WebInspector.UIString("Use %s Click to select multiple types.",WebInspector.KeyboardShortcut.shortcutToString("",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta));this._allowedTypes={};this._typeFilterElements={};this.addBit(WebInspector.NamedBitSetFilterUI.ALL_TYPES,WebInspector.UIString("All"));this._filtersElement.createChild("div","filter-bitset-filter-divider");this._toggleTypeFilter(WebInspector.NamedBitSetFilterUI.ALL_TYPES,false);}
9186 WebInspector.NamedBitSetFilterUI.ALL_TYPES="all";WebInspector.NamedBitSetFilterUI.prototype={isActive:function()
9187 {return!this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES];},bindSetting:function(setting)
9188 {console.assert(!this._setting);this._setting=setting;setting.addChangeListener(this._settingChanged.bind(this));this._settingChanged();},element:function()
9189 {return this._filtersElement;},accept:function(typeName)
9190 {return!!this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]||!!this._allowedTypes[typeName];},_settingChanged:function()
9191 {var allowedTypes=this._setting.get();this._allowedTypes={};for(var typeName in this._typeFilterElements){if(allowedTypes[typeName])
9192 this._allowedTypes[typeName]=true;}
9193 this._update();},_update:function()
9194 {if((Object.keys(this._allowedTypes).length===0)||this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]){this._allowedTypes={};this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]=true;}
9195 for(var typeName in this._typeFilterElements)
9196 this._typeFilterElements[typeName].enableStyleClass("selected",this._allowedTypes[typeName]);this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},addBit:function(name,label)
9197 {var typeFilterElement=this._filtersElement.createChild("li",name);typeFilterElement.typeName=name;typeFilterElement.createTextChild(label);typeFilterElement.addEventListener("click",this._onTypeFilterClicked.bind(this),false);this._typeFilterElements[name]=typeFilterElement;},_onTypeFilterClicked:function(e)
9198 {var toggle;if(WebInspector.isMac())
9199 toggle=e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey;else
9200 toggle=e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey;this._toggleTypeFilter(e.target.typeName,toggle);},_toggleTypeFilter:function(typeName,allowMultiSelect)
9201 {if(allowMultiSelect&&typeName!==WebInspector.NamedBitSetFilterUI.ALL_TYPES)
9202 this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]=false;else
9203 this._allowedTypes={};this._allowedTypes[typeName]=!this._allowedTypes[typeName];if(this._setting)
9204 this._setting.set(this._allowedTypes);else
9205 this._update();},__proto__:WebInspector.Object.prototype}
9206 WebInspector.ComboBoxFilterUI=function(options)
9207 {this._filterElement=document.createElement("div");this._filterElement.className="filter-combobox-filter";this._options=options;this._filterComboBox=new WebInspector.StatusBarComboBox(this._filterChanged.bind(this));for(var i=0;i<options.length;++i){var filterOption=options[i];var option=document.createElement("option");option.text=filterOption.label;option.title=filterOption.title;this._filterComboBox.addOption(option);this._filterComboBox.element.title=this._filterComboBox.selectedOption().title;}
9208 this._filterElement.appendChild(this._filterComboBox.element);}
9209 WebInspector.ComboBoxFilterUI.prototype={isActive:function()
9210 {return this._filterComboBox.selectedIndex()!==0;},element:function()
9211 {return this._filterElement;},value:function(typeName)
9212 {var option=this._options[this._filterComboBox.selectedIndex()];return option.value;},setSelectedIndex:function(index)
9213 {this._filterComboBox.setSelectedIndex(index);},selectedIndex:function(index)
9214 {return this._filterComboBox.selectedIndex();},_filterChanged:function(event)
9215 {var option=this._options[this._filterComboBox.selectedIndex()];this._filterComboBox.element.title=option.title;this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},__proto__:WebInspector.Object.prototype}
9216 WebInspector.CheckboxFilterUI=function(className,title,activeWhenChecked,setting)
9217 {this._filterElement=document.createElement("div");this._filterElement.classList.add("filter-checkbox-filter","filter-checkbox-filter-"+className);this._activeWhenChecked=!!activeWhenChecked;this._createCheckbox(title);if(setting){this._setting=setting;setting.addChangeListener(this._settingChanged.bind(this));this._settingChanged();}else{this._checked=!this._activeWhenChecked;this._update();}}
9218 WebInspector.CheckboxFilterUI.prototype={isActive:function()
9219 {return this._activeWhenChecked===this._checked;},element:function()
9220 {return this._filterElement;},checked:function()
9221 {return this._checked;},setState:function(state)
9222 {this._checked=state;this._update();},_update:function()
9223 {this._checkElement.enableStyleClass("checkbox-filter-checkbox-checked",this._checked);this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},_settingChanged:function()
9224 {this._checked=this._setting.get();this._update();},_onClick:function(event)
9225 {this._checked=!this._checked;if(this._setting)
9226 this._setting.set(this._checked);else
9227 this._update();},_createCheckbox:function(title)
9228 {var label=this._filterElement.createChild("label");var checkBorder=label.createChild("div","checkbox-filter-checkbox");this._checkElement=checkBorder.createChild("div","checkbox-filter-checkbox-check");this._filterElement.addEventListener("click",this._onClick.bind(this),false);var typeElement=label.createChild("span","type");typeElement.textContent=title;},__proto__:WebInspector.Object.prototype}
9229 WebInspector.InspectElementModeController=function()
9230 {this.toggleSearchButton=new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."),"node-search-status-bar-item");this.toggleSearchButton.addEventListener("click",this.toggleSearch,this);this._shortcut=WebInspector.InspectElementModeController.createShortcut();}
9231 WebInspector.InspectElementModeController.createShortcut=function()
9232 {return WebInspector.KeyboardShortcut.makeDescriptor("c",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta|WebInspector.KeyboardShortcut.Modifiers.Shift);}
9233 WebInspector.InspectElementModeController.prototype={enabled:function()
9234 {return this.toggleSearchButton.toggled;},disable:function()
9235 {if(this.enabled())
9236 this.toggleSearch();},toggleSearch:function()
9237 {var enabled=!this.enabled();function callback(error)
9238 {if(!error)
9239 this.toggleSearchButton.toggled=enabled;}
9240 WebInspector.domAgent.setInspectModeEnabled(enabled,WebInspector.settings.showShadowDOM.get(),callback.bind(this));},handleShortcut:function(event)
9241 {if(WebInspector.KeyboardShortcut.makeKeyFromEvent(event)!==this._shortcut.key)
9242 return false;this.toggleSearch();event.consume(true);return true;}}
9243 WebInspector.inspectElementModeController;WebInspector.WorkerManager=function()
9244 {this._workerIdToWindow={};InspectorBackend.registerWorkerDispatcher(new WebInspector.WorkerDispatcher(this));}
9245 WebInspector.WorkerManager.isWorkerFrontend=function()
9246 {return!!WebInspector.queryParamsObject["dedicatedWorkerId"]||!!WebInspector.queryParamsObject["isSharedWorker"];}
9247 WebInspector.WorkerManager.isDedicatedWorkerFrontend=function()
9248 {return!!WebInspector.queryParamsObject["dedicatedWorkerId"];}
9249 WebInspector.WorkerManager.loaded=function()
9250 {var workerId=WebInspector.queryParamsObject["dedicatedWorkerId"];if(workerId)
9251 WebInspector.WorkerManager._initializeDedicatedWorkerFrontend(workerId);else
9252 WebInspector.workerManager=new WebInspector.WorkerManager();}
9253 WebInspector.WorkerManager.loadCompleted=function()
9254 {if(WebInspector.queryParamsObject["workerPaused"]){DebuggerAgent.pause();RuntimeAgent.run(calculateTitle);}else if(WebInspector.WorkerManager.isWorkerFrontend())
9255 calculateTitle();function calculateTitle()
9256 {WebInspector.WorkerManager._calculateWorkerInspectorTitle();}
9257 if(WebInspector.workerManager)
9258 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,WebInspector.workerManager._mainFrameNavigated,WebInspector.workerManager);}
9259 WebInspector.WorkerManager._initializeDedicatedWorkerFrontend=function(workerId)
9260 {function receiveMessage(event)
9261 {var message=event.data;InspectorBackend.dispatch(message);}
9262 window.addEventListener("message",receiveMessage,true);InspectorBackend.sendMessageObjectToBackend=function(message)
9263 {window.opener.postMessage({workerId:workerId,command:"sendMessageToBackend",message:message},"*");}}
9264 WebInspector.WorkerManager._calculateWorkerInspectorTitle=function()
9265 {var expression="location.href";if(WebInspector.queryParamsObject["isSharedWorker"])
9266 expression+=" + (this.name ? ' (' + this.name + ')' : '')";RuntimeAgent.evaluate.invoke({expression:expression,doNotPauseOnExceptionsAndMuteConsole:true,returnByValue:true},evalCallback.bind(this));function evalCallback(error,result,wasThrown)
9267 {if(error||wasThrown){console.error(error);return;}
9268 InspectorFrontendHost.inspectedURLChanged(result.value);}}
9269 WebInspector.WorkerManager.Events={WorkerAdded:"worker-added",WorkerRemoved:"worker-removed",WorkersCleared:"workers-cleared",}
9270 WebInspector.WorkerManager.prototype={_workerCreated:function(workerId,url,inspectorConnected)
9271 {if(inspectorConnected)
9272 this._openInspectorWindow(workerId,true);this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkerAdded,{workerId:workerId,url:url,inspectorConnected:inspectorConnected});},_workerTerminated:function(workerId)
9273 {this.closeWorkerInspector(workerId);this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkerRemoved,workerId);},_sendMessageToWorkerInspector:function(workerId,message)
9274 {var workerInspectorWindow=this._workerIdToWindow[workerId];if(workerInspectorWindow)
9275 workerInspectorWindow.postMessage(message,"*");},openWorkerInspector:function(workerId)
9276 {var existingInspector=this._workerIdToWindow[workerId];if(existingInspector){existingInspector.focus();return;}
9277 this._openInspectorWindow(workerId,false);WorkerAgent.connectToWorker(workerId);},_openInspectorWindow:function(workerId,workerIsPaused)
9278 {var search=window.location.search;var hash=window.location.hash;var url=window.location.href;url=url.replace(hash,"");url+=(search?"&dedicatedWorkerId=":"?dedicatedWorkerId=")+workerId;if(workerIsPaused)
9279 url+="&workerPaused=true";url=url.replace("docked=true&","");url=url.replace("can_dock=true&","");url+=hash;var width=WebInspector.settings.workerInspectorWidth.get();var height=WebInspector.settings.workerInspectorHeight.get();var workerInspectorWindow=window.open(url,undefined,"location=0,width="+width+",height="+height);workerInspectorWindow.addEventListener("resize",this._onWorkerInspectorResize.bind(this,workerInspectorWindow),false);this._workerIdToWindow[workerId]=workerInspectorWindow;workerInspectorWindow.addEventListener("beforeunload",this._workerInspectorClosing.bind(this,workerId),true);window.addEventListener("unload",this._pageInspectorClosing.bind(this),true);},closeWorkerInspector:function(workerId)
9280 {var workerInspectorWindow=this._workerIdToWindow[workerId];if(workerInspectorWindow)
9281 workerInspectorWindow.close();},_mainFrameNavigated:function(event)
9282 {for(var workerId in this._workerIdToWindow)
9283 this.closeWorkerInspector(workerId);this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkersCleared);},_pageInspectorClosing:function()
9284 {this._ignoreWorkerInspectorClosing=true;for(var workerId in this._workerIdToWindow){this._workerIdToWindow[workerId].close();WorkerAgent.disconnectFromWorker(parseInt(workerId,10));}},_onWorkerInspectorResize:function(workerInspectorWindow)
9285 {var doc=workerInspectorWindow.document;WebInspector.settings.workerInspectorWidth.set(doc.width);WebInspector.settings.workerInspectorHeight.set(doc.height);},_workerInspectorClosing:function(workerId,event)
9286 {if(event.target.location.href==="about:blank")
9287 return;if(this._ignoreWorkerInspectorClosing)
9288 return;delete this._workerIdToWindow[workerId];WorkerAgent.disconnectFromWorker(workerId);},_disconnectedFromWorker:function()
9289 {var screen=new WebInspector.WorkerTerminatedScreen();WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,screen.hide,screen);screen.showModal();},__proto__:WebInspector.Object.prototype}
9290 WebInspector.WorkerDispatcher=function(workerManager)
9291 {this._workerManager=workerManager;window.addEventListener("message",this._receiveMessage.bind(this),true);}
9292 WebInspector.WorkerDispatcher.prototype={_receiveMessage:function(event)
9293 {var workerId=event.data["workerId"];workerId=parseInt(workerId,10);var command=event.data.command;var message=event.data.message;if(command=="sendMessageToBackend")
9294 WorkerAgent.sendMessageToWorker(workerId,message);},workerCreated:function(workerId,url,inspectorConnected)
9295 {this._workerManager._workerCreated(workerId,url,inspectorConnected);},workerTerminated:function(workerId)
9296 {this._workerManager._workerTerminated(workerId);},dispatchMessageFromWorker:function(workerId,message)
9297 {this._workerManager._sendMessageToWorkerInspector(workerId,message);},disconnectedFromWorker:function()
9298 {this._workerManager._disconnectedFromWorker();}}
9299 WebInspector.WorkerTerminatedScreen=function()
9300 {WebInspector.HelpScreen.call(this,WebInspector.UIString("Inspected worker terminated"));var p=this.contentElement.createChild("p");p.classList.add("help-section");p.textContent=WebInspector.UIString("Inspected worker has terminated. Once it restarts we will attach to it automatically.");}
9301 WebInspector.WorkerTerminatedScreen.prototype={willHide:function()
9302 {WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this.hide,this);WebInspector.HelpScreen.prototype.willHide.call(this);},__proto__:WebInspector.HelpScreen.prototype}
9303 WebInspector.UserMetrics=function()
9304 {for(var actionName in WebInspector.UserMetrics._ActionCodes){var actionCode=WebInspector.UserMetrics._ActionCodes[actionName];this[actionName]=new WebInspector.UserMetrics._Recorder(actionCode);}
9305 function settingChanged(trueCode,falseCode,event)
9306 {if(event.data)
9307 InspectorFrontendHost.recordSettingChanged(trueCode);else
9308 InspectorFrontendHost.recordSettingChanged(falseCode);}
9309 WebInspector.settings.domWordWrap.addChangeListener(settingChanged.bind(this,WebInspector.UserMetrics._SettingCodes.ElementsDOMWrapOn,WebInspector.UserMetrics._SettingCodes.ElementsDOMWrapOff));WebInspector.settings.monitoringXHREnabled.addChangeListener(settingChanged.bind(this,WebInspector.UserMetrics._SettingCodes.ConsoleMonitorXHROn,WebInspector.UserMetrics._SettingCodes.ConsoleMonitorXHROff));WebInspector.settings.preserveConsoleLog.addChangeListener(settingChanged.bind(this,WebInspector.UserMetrics._SettingCodes.ConsolePreserveLogOn,WebInspector.UserMetrics._SettingCodes.ConsolePreserveLogOff));WebInspector.settings.resourcesLargeRows.addChangeListener(settingChanged.bind(this,WebInspector.UserMetrics._SettingCodes.NetworkShowLargeRowsOn,WebInspector.UserMetrics._SettingCodes.NetworkShowLargeRowsOff));}
9310 WebInspector.UserMetrics._ActionCodes={WindowDocked:1,WindowUndocked:2,ScriptsBreakpointSet:3,TimelineStarted:4,ProfilesCPUProfileTaken:5,ProfilesHeapProfileTaken:6,AuditsStarted:7,ConsoleEvaluated:8}
9311 WebInspector.UserMetrics._SettingCodes={ElementsDOMWrapOn:1,ElementsDOMWrapOff:2,ConsoleMonitorXHROn:3,ConsoleMonitorXHROff:4,ConsolePreserveLogOn:5,ConsolePreserveLogOff:6,NetworkShowLargeRowsOn:7,NetworkShowLargeRowsOff:8}
9312 WebInspector.UserMetrics._PanelCodes={elements:1,resources:2,network:3,scripts:4,timeline:5,profiles:6,audits:7,console:8}
9313 WebInspector.UserMetrics.UserAction="UserAction";WebInspector.UserMetrics.UserActionNames={ForcedElementState:"forcedElementState",FileSaved:"fileSaved",RevertRevision:"revertRevision",ApplyOriginalContent:"applyOriginalContent",TogglePrettyPrint:"togglePrettyPrint",SetBreakpoint:"setBreakpoint",OpenSourceLink:"openSourceLink",NetworkSort:"networkSort",NetworkRequestSelected:"networkRequestSelected",NetworkRequestTabSelected:"networkRequestTabSelected",HeapSnapshotFilterChanged:"heapSnapshotFilterChanged"};WebInspector.UserMetrics.prototype={panelShown:function(panelName)
9314 {InspectorFrontendHost.recordPanelShown(WebInspector.UserMetrics._PanelCodes[panelName]||0);}}
9315 WebInspector.UserMetrics._Recorder=function(actionCode)
9316 {this._actionCode=actionCode;}
9317 WebInspector.UserMetrics._Recorder.prototype={record:function()
9318 {InspectorFrontendHost.recordActionTaken(this._actionCode);}}
9319 WebInspector.userMetrics=new WebInspector.UserMetrics();WebInspector.RuntimeModel=function(resourceTreeModel)
9320 {resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded,this._frameAdded,this);resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,this._frameNavigated,this);resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this._frameDetached,this);resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded,this._didLoadCachedResources,this);this._frameIdToContextList={};}
9321 WebInspector.RuntimeModel.Events={FrameExecutionContextListAdded:"FrameExecutionContextListAdded",FrameExecutionContextListRemoved:"FrameExecutionContextListRemoved",}
9322 WebInspector.RuntimeModel.prototype={setCurrentExecutionContext:function(executionContext)
9323 {this._currentExecutionContext=executionContext;},currentExecutionContext:function()
9324 {return this._currentExecutionContext;},contextLists:function()
9325 {return Object.values(this._frameIdToContextList);},contextListByFrame:function(frame)
9326 {return this._frameIdToContextList[frame.id];},_frameAdded:function(event)
9327 {var frame=event.data;var context=new WebInspector.FrameExecutionContextList(frame);this._frameIdToContextList[frame.id]=context;this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.FrameExecutionContextListAdded,context);},_frameNavigated:function(event)
9328 {var frame=event.data;var context=this._frameIdToContextList[frame.id];if(context)
9329 context._frameNavigated(frame);},_frameDetached:function(event)
9330 {var frame=event.data;var context=this._frameIdToContextList[frame.id];if(!context)
9331 return;this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.FrameExecutionContextListRemoved,context);delete this._frameIdToContextList[frame.id];},_didLoadCachedResources:function()
9332 {InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(this));RuntimeAgent.enable();},_executionContextCreated:function(context)
9333 {var contextList=this._frameIdToContextList[context.frameId];if(!contextList)
9334 return;contextList._addExecutionContext(new WebInspector.ExecutionContext(context.id,context.name,context.isPageContext));},evaluate:function(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
9335 {if(WebInspector.debuggerModel.selectedCallFrame()){WebInspector.debuggerModel.evaluateOnSelectedCallFrame(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback);return;}
9336 if(!expression){expression="this";}
9337 function evalCallback(error,result,wasThrown)
9338 {if(error){callback(null,false);return;}
9339 if(returnByValue)
9340 callback(null,!!wasThrown,wasThrown?null:result);else
9341 callback(WebInspector.RemoteObject.fromPayload(result),!!wasThrown);}
9342 RuntimeAgent.evaluate(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,this._currentExecutionContext?this._currentExecutionContext.id:undefined,returnByValue,generatePreview,evalCallback);},completionsForTextPrompt:function(proxyElement,wordRange,force,completionsReadyCallback)
9343 {var expressionRange=wordRange.startContainer.rangeOfWord(wordRange.startOffset," =:[({;,!+-*/&|^<>",proxyElement,"backward");var expressionString=expressionRange.toString();var prefix=wordRange.toString();this._completionsForExpression(expressionString,prefix,force,completionsReadyCallback);},_completionsForExpression:function(expressionString,prefix,force,completionsReadyCallback)
9344 {var lastIndex=expressionString.length-1;var dotNotation=(expressionString[lastIndex]===".");var bracketNotation=(expressionString[lastIndex]==="[");if(dotNotation||bracketNotation)
9345 expressionString=expressionString.substr(0,lastIndex);if(expressionString&&parseInt(expressionString,10)==expressionString){completionsReadyCallback([]);return;}
9346 if(!prefix&&!expressionString&&!force){completionsReadyCallback([]);return;}
9347 if(!expressionString&&WebInspector.debuggerModel.selectedCallFrame())
9348 WebInspector.debuggerModel.getSelectedCallFrameVariables(receivedPropertyNames.bind(this));else
9349 this.evaluate(expressionString,"completion",true,true,false,false,evaluated.bind(this));function evaluated(result,wasThrown)
9350 {if(!result||wasThrown){completionsReadyCallback([]);return;}
9351 function getCompletions(primitiveType)
9352 {var object;if(primitiveType==="string")
9353 object=new String("");else if(primitiveType==="number")
9354 object=new Number(0);else if(primitiveType==="boolean")
9355 object=new Boolean(false);else
9356 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)
9357 resultSet[names[i]]=true;}catch(e){}}
9358 return resultSet;}
9359 if(result.type==="object"||result.type==="function")
9360 result.callFunctionJSON(getCompletions,undefined,receivedPropertyNames.bind(this));else if(result.type==="string"||result.type==="number"||result.type==="boolean")
9361 this.evaluate("("+getCompletions+")(\""+result.type+"\")","completion",false,true,true,false,receivedPropertyNamesFromEval.bind(this));}
9362 function receivedPropertyNamesFromEval(notRelevant,wasThrown,result)
9363 {if(result&&!wasThrown)
9364 receivedPropertyNames.call(this,result.value);else
9365 completionsReadyCallback([]);}
9366 function receivedPropertyNames(propertyNames)
9367 {RuntimeAgent.releaseObjectGroup("completion");if(!propertyNames){completionsReadyCallback([]);return;}
9368 var includeCommandLineAPI=(!dotNotation&&!bracketNotation);if(includeCommandLineAPI){const commandLineAPI=["dir","dirxml","keys","values","profile","profileEnd","monitorEvents","unmonitorEvents","inspect","copy","clear","getEventListeners","debug","undebug","monitor","unmonitor","table","$","$$","$x"];for(var i=0;i<commandLineAPI.length;++i)
9369 propertyNames[commandLineAPI[i]]=true;}
9370 this._reportCompletions(completionsReadyCallback,dotNotation,bracketNotation,expressionString,prefix,Object.keys(propertyNames));}},_reportCompletions:function(completionsReadyCallback,dotNotation,bracketNotation,expressionString,prefix,properties){if(bracketNotation){if(prefix.length&&prefix[0]==="'")
9371 var quoteUsed="'";else
9372 var quoteUsed="\"";}
9373 var results=[];if(!expressionString){const keywords=["break","case","catch","continue","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","this","throw","try","typeof","var","void","while","with"];properties=properties.concat(keywords);}
9374 properties.sort();for(var i=0;i<properties.length;++i){var property=properties[i];if(dotNotation&&!/^[a-zA-Z_$\u008F-\uFFFF][a-zA-Z0-9_$\u008F-\uFFFF]*$/.test(property))
9375 continue;if(bracketNotation){if(!/^[0-9]+$/.test(property))
9376 property=quoteUsed+property.escapeCharacters(quoteUsed+"\\")+quoteUsed;property+="]";}
9377 if(property.length<prefix.length)
9378 continue;if(prefix.length&&!property.startsWith(prefix))
9379 continue;results.push(property);}
9380 completionsReadyCallback(results);},__proto__:WebInspector.Object.prototype}
9381 WebInspector.runtimeModel;WebInspector.RuntimeDispatcher=function(runtimeModel)
9382 {this._runtimeModel=runtimeModel;}
9383 WebInspector.RuntimeDispatcher.prototype={executionContextCreated:function(context)
9384 {this._runtimeModel._executionContextCreated(context);}}
9385 WebInspector.ExecutionContext=function(id,name,isPageContext)
9386 {this.id=id;this.name=(isPageContext&&!name)?"<page context>":name;this.isMainWorldContext=isPageContext;}
9387 WebInspector.ExecutionContext.comparator=function(a,b)
9388 {if(a.isMainWorldContext)
9389 return-1;if(b.isMainWorldContext)
9390 return+1;return a.name.localeCompare(b.name);}
9391 WebInspector.FrameExecutionContextList=function(frame)
9392 {this._frame=frame;this._executionContexts=[];}
9393 WebInspector.FrameExecutionContextList.EventTypes={ContextsUpdated:"ContextsUpdated",ContextAdded:"ContextAdded"}
9394 WebInspector.FrameExecutionContextList.prototype={_frameNavigated:function(frame)
9395 {this._frame=frame;this._executionContexts=[];this.dispatchEventToListeners(WebInspector.FrameExecutionContextList.EventTypes.ContextsUpdated,this);},_addExecutionContext:function(context)
9396 {var insertAt=insertionIndexForObjectInListSortedByFunction(context,this._executionContexts,WebInspector.ExecutionContext.comparator);this._executionContexts.splice(insertAt,0,context);this.dispatchEventToListeners(WebInspector.FrameExecutionContextList.EventTypes.ContextAdded,this);},executionContexts:function()
9397 {return this._executionContexts;},mainWorldContext:function()
9398 {return this._executionContexts[0];},contextBySecurityOrigin:function(securityOrigin)
9399 {for(var i=0;i<this._executionContexts.length;++i){var context=this._executionContexts[i];if(!context.isMainWorldContext&&context.name===securityOrigin)
9400 return context;}
9401 return null;},get frameId()
9402 {return this._frame.id;},get url()
9403 {return this._frame.url;},get displayName()
9404 {if(!this._frame.parentFrame)
9405 return"<top frame>";var name=this._frame.name||"";var subtitle=new WebInspector.ParsedURL(this._frame.url).displayName;if(subtitle){if(!name)
9406 return subtitle;return name+"( "+subtitle+" )";}
9407 return"<iframe>";},__proto__:WebInspector.Object.prototype}
9408 WebInspector.HandlerRegistry=function(setting)
9409 {WebInspector.Object.call(this);this._handlers={};this._setting=setting;this._activeHandler=this._setting.get();WebInspector.moduleManager.registerModule({name:"HandlerRegistry",extensions:[{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.UISourceCode","WebInspector.Resource","WebInspector.NetworkRequest","Node"],className:"WebInspector.HandlerRegistry.ContextMenuProvider"}]});}
9410 WebInspector.HandlerRegistry.prototype={get handlerNames()
9411 {return Object.getOwnPropertyNames(this._handlers);},get activeHandler()
9412 {return this._activeHandler;},set activeHandler(value)
9413 {this._activeHandler=value;this._setting.set(value);},dispatch:function(data)
9414 {return this.dispatchToHandler(this._activeHandler,data);},dispatchToHandler:function(name,data)
9415 {var handler=this._handlers[name];var result=handler&&handler(data);return!!result;},registerHandler:function(name,handler)
9416 {this._handlers[name]=handler;this.dispatchEventToListeners(WebInspector.HandlerRegistry.EventTypes.HandlersUpdated);},unregisterHandler:function(name)
9417 {delete this._handlers[name];this.dispatchEventToListeners(WebInspector.HandlerRegistry.EventTypes.HandlersUpdated);},_appendContentProviderItems:function(contextMenu,target)
9418 {if(!(target instanceof WebInspector.UISourceCode||target instanceof WebInspector.Resource||target instanceof WebInspector.NetworkRequest))
9419 return;var contentProvider=(target);if(!contentProvider.contentURL())
9420 return;contextMenu.appendItem(WebInspector.openLinkExternallyLabel(),WebInspector.openResource.bind(WebInspector,contentProvider.contentURL(),false));for(var i=1;i<this.handlerNames.length;++i){var handler=this.handlerNames[i];contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Open using %s":"Open Using %s",handler),this.dispatchToHandler.bind(this,handler,{url:contentProvider.contentURL()}));}
9421 contextMenu.appendItem(WebInspector.copyLinkAddressLabel(),InspectorFrontendHost.copyText.bind(InspectorFrontendHost,contentProvider.contentURL()));if(!contentProvider.contentURL())
9422 return;var contentType=contentProvider.contentType();if(contentType!==WebInspector.resourceTypes.Document&&contentType!==WebInspector.resourceTypes.Stylesheet&&contentType!==WebInspector.resourceTypes.Script)
9423 return;function doSave(forceSaveAs,content)
9424 {var url=contentProvider.contentURL();WebInspector.fileManager.save(url,(content),forceSaveAs);WebInspector.fileManager.close(url);}
9425 function save(forceSaveAs)
9426 {if(contentProvider instanceof WebInspector.UISourceCode){var uiSourceCode=(contentProvider);uiSourceCode.saveToFileSystem(forceSaveAs);return;}
9427 contentProvider.requestContent(doSave.bind(this,forceSaveAs));}
9428 contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Save"),save.bind(this,false));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Save as...":"Save As..."),save.bind(this,true));},_appendHrefItems:function(contextMenu,target)
9429 {if(!(target instanceof Node))
9430 return;var targetNode=(target);var anchorElement=targetNode.enclosingNodeOrSelfWithClass("webkit-html-resource-link")||targetNode.enclosingNodeOrSelfWithClass("webkit-html-external-link");if(!anchorElement)
9431 return;var resourceURL=anchorElement.href;if(!resourceURL)
9432 return;contextMenu.appendItem(WebInspector.openLinkExternallyLabel(),WebInspector.openResource.bind(WebInspector,resourceURL,false));if(WebInspector.resourceForURL(resourceURL))
9433 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Open link in Resources panel":"Open Link in Resources Panel"),WebInspector.openResource.bind(null,resourceURL,true));contextMenu.appendItem(WebInspector.copyLinkAddressLabel(),InspectorFrontendHost.copyText.bind(InspectorFrontendHost,resourceURL));},__proto__:WebInspector.Object.prototype}
9434 WebInspector.HandlerRegistry.EventTypes={HandlersUpdated:"HandlersUpdated"}
9435 WebInspector.HandlerSelector=function(handlerRegistry)
9436 {this._handlerRegistry=handlerRegistry;this.element=document.createElement("select");this.element.addEventListener("change",this._onChange.bind(this),false);this._update();this._handlerRegistry.addEventListener(WebInspector.HandlerRegistry.EventTypes.HandlersUpdated,this._update.bind(this));}
9437 WebInspector.HandlerSelector.prototype={_update:function()
9438 {this.element.removeChildren();var names=this._handlerRegistry.handlerNames;var activeHandler=this._handlerRegistry.activeHandler;for(var i=0;i<names.length;++i){var option=document.createElement("option");option.textContent=names[i];option.selected=activeHandler===names[i];this.element.appendChild(option);}
9439 this.element.disabled=names.length<=1;},_onChange:function(event)
9440 {var value=event.target.value;this._handlerRegistry.activeHandler=value;}}
9441 WebInspector.HandlerRegistry.ContextMenuProvider=function()
9442 {}
9443 WebInspector.HandlerRegistry.ContextMenuProvider.prototype={appendApplicableItems:function(event,contextMenu,target)
9444 {WebInspector.openAnchorLocationRegistry._appendContentProviderItems(contextMenu,target);WebInspector.openAnchorLocationRegistry._appendHrefItems(contextMenu,target);}}
9445 WebInspector.openAnchorLocationRegistry;WebInspector.SnippetStorage=function(settingPrefix,namePrefix)
9446 {this._snippets={};this._lastSnippetIdentifierSetting=WebInspector.settings.createSetting(settingPrefix+"Snippets_lastIdentifier",0);this._snippetsSetting=WebInspector.settings.createSetting(settingPrefix+"Snippets",[]);this._namePrefix=namePrefix;this._loadSettings();}
9447 WebInspector.SnippetStorage.prototype={get namePrefix()
9448 {return this._namePrefix;},_saveSettings:function()
9449 {var savedSnippets=[];for(var id in this._snippets)
9450 savedSnippets.push(this._snippets[id].serializeToObject());this._snippetsSetting.set(savedSnippets);},snippets:function()
9451 {var result=[];for(var id in this._snippets)
9452 result.push(this._snippets[id]);return result;},snippetForId:function(id)
9453 {return this._snippets[id];},snippetForName:function(name)
9454 {var snippets=Object.values(this._snippets);for(var i=0;i<snippets.length;++i)
9455 if(snippets[i].name===name)
9456 return snippets[i];return null;},_loadSettings:function()
9457 {var savedSnippets=this._snippetsSetting.get();for(var i=0;i<savedSnippets.length;++i)
9458 this._snippetAdded(WebInspector.Snippet.fromObject(this,savedSnippets[i]));},deleteSnippet:function(snippet)
9459 {delete this._snippets[snippet.id];this._saveSettings();},createSnippet:function()
9460 {var nextId=this._lastSnippetIdentifierSetting.get()+1;var snippetId=String(nextId);this._lastSnippetIdentifierSetting.set(nextId);var snippet=new WebInspector.Snippet(this,snippetId);this._snippetAdded(snippet);this._saveSettings();return snippet;},_snippetAdded:function(snippet)
9461 {this._snippets[snippet.id]=snippet;},reset:function()
9462 {this._lastSnippetIdentifierSetting.set(0);this._snippetsSetting.set([]);this._snippets={};},__proto__:WebInspector.Object.prototype}
9463 WebInspector.Snippet=function(storage,id,name,content)
9464 {this._storage=storage;this._id=id;this._name=name||storage.namePrefix+id;this._content=content||"";}
9465 WebInspector.Snippet.fromObject=function(storage,serializedSnippet)
9466 {return new WebInspector.Snippet(storage,serializedSnippet.id,serializedSnippet.name,serializedSnippet.content);}
9467 WebInspector.Snippet.prototype={get id()
9468 {return this._id;},get name()
9469 {return this._name;},set name(name)
9470 {if(this._name===name)
9471 return;this._name=name;this._storage._saveSettings();},get content()
9472 {return this._content;},set content(content)
9473 {if(this._content===content)
9474 return;this._content=content;this._storage._saveSettings();},serializeToObject:function()
9475 {var serializedSnippet={};serializedSnippet.id=this.id;serializedSnippet.name=this.name;serializedSnippet.content=this.content;return serializedSnippet;},__proto__:WebInspector.Object.prototype}
9476 WebInspector.ScriptSnippetModel=function(workspace)
9477 {this._workspace=workspace;this._uiSourceCodeForScriptId={};this._scriptForUISourceCode=new Map();this._uiSourceCodeForSnippetId={};this._snippetIdForUISourceCode=new Map();this._snippetStorage=new WebInspector.SnippetStorage("script","Script snippet #");this._lastSnippetEvaluationIndexSetting=WebInspector.settings.createSetting("lastSnippetEvaluationIndex",0);this._snippetScriptMapping=new WebInspector.SnippetScriptMapping(this);this._projectDelegate=new WebInspector.SnippetsProjectDelegate(this);this._project=this._workspace.addProject(this._projectDelegate);this.reset();WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
9478 WebInspector.ScriptSnippetModel.prototype={get scriptMapping()
9479 {return this._snippetScriptMapping;},project:function()
9480 {return this._project;},_loadSnippets:function()
9481 {var snippets=this._snippetStorage.snippets();for(var i=0;i<snippets.length;++i)
9482 this._addScriptSnippet(snippets[i]);},createScriptSnippet:function(content)
9483 {var snippet=this._snippetStorage.createSnippet();snippet.content=content;return this._addScriptSnippet(snippet);},_addScriptSnippet:function(snippet)
9484 {var path=this._projectDelegate.addSnippet(snippet.name,new WebInspector.SnippetContentProvider(snippet));var uiSourceCode=this._workspace.uiSourceCode(this._projectDelegate.id(),path);if(!uiSourceCode){console.assert(uiSourceCode);return"";}
9485 var scriptFile=new WebInspector.SnippetScriptFile(this,uiSourceCode);uiSourceCode.setScriptFile(scriptFile);this._snippetIdForUISourceCode.put(uiSourceCode,snippet.id);uiSourceCode.setSourceMapping(this._snippetScriptMapping);this._uiSourceCodeForSnippetId[snippet.id]=uiSourceCode;return path;},deleteScriptSnippet:function(path)
9486 {var uiSourceCode=this._workspace.uiSourceCode(this._projectDelegate.id(),path);if(!uiSourceCode)
9487 return;var snippetId=this._snippetIdForUISourceCode.get(uiSourceCode)||"";var snippet=this._snippetStorage.snippetForId(snippetId);this._snippetStorage.deleteSnippet(snippet);this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);delete this._uiSourceCodeForSnippetId[snippet.id];this._snippetIdForUISourceCode.remove(uiSourceCode);this._projectDelegate.removeFile(snippet.name);},renameScriptSnippet:function(name,newName,callback)
9488 {newName=newName.trim();if(!newName||newName.indexOf("/")!==-1||name===newName||this._snippetStorage.snippetForName(newName)){callback(false);return;}
9489 var snippet=this._snippetStorage.snippetForName(name);console.assert(snippet,"Snippet '"+name+"' was not found.");var uiSourceCode=this._uiSourceCodeForSnippetId[snippet.id];console.assert(uiSourceCode,"No uiSourceCode was found for snippet '"+name+"'.");var breakpointLocations=this._removeBreakpoints(uiSourceCode);snippet.name=newName;this._restoreBreakpoints(uiSourceCode,breakpointLocations);callback(true,newName);},_setScriptSnippetContent:function(name,newContent)
9490 {var snippet=this._snippetStorage.snippetForName(name);snippet.content=newContent;},_scriptSnippetEdited:function(uiSourceCode)
9491 {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
9492 return;var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);var scriptUISourceCode=script.rawLocationToUILocation(0,0).uiSourceCode;if(scriptUISourceCode)
9493 this._restoreBreakpoints(scriptUISourceCode,breakpointLocations);},_nextEvaluationIndex:function(snippetId)
9494 {var evaluationIndex=this._lastSnippetEvaluationIndexSetting.get()+1;this._lastSnippetEvaluationIndexSetting.set(evaluationIndex);return evaluationIndex;},evaluateScriptSnippet:function(uiSourceCode)
9495 {var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);var snippetId=this._snippetIdForUISourceCode.get(uiSourceCode)||"";var evaluationIndex=this._nextEvaluationIndex(snippetId);uiSourceCode._evaluationIndex=evaluationIndex;var evaluationUrl=this._evaluationSourceURL(uiSourceCode);var expression=uiSourceCode.workingCopy();if(WebInspector.debuggerModel.selectedCallFrame()){expression=uiSourceCode.workingCopy()+"\n//# sourceURL="+evaluationUrl+"\n";WebInspector.evaluateInConsole(expression,true);return;}
9496 WebInspector.showConsole();DebuggerAgent.compileScript(expression,evaluationUrl,compileCallback.bind(this));function compileCallback(error,scriptId,syntaxErrorMessage)
9497 {if(!uiSourceCode||uiSourceCode._evaluationIndex!==evaluationIndex)
9498 return;if(error){console.error(error);return;}
9499 if(!scriptId){var consoleMessage=WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.JS,WebInspector.ConsoleMessage.MessageLevel.Error,syntaxErrorMessage||"");WebInspector.console.addMessage(consoleMessage);return;}
9500 var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);this._runScript(scriptId);}},_runScript:function(scriptId)
9501 {var currentExecutionContext=WebInspector.runtimeModel.currentExecutionContext();DebuggerAgent.runScript(scriptId,currentExecutionContext?currentExecutionContext.id:undefined,"console",false,runCallback.bind(this));function runCallback(error,result,wasThrown)
9502 {if(error){console.error(error);return;}
9503 this._printRunScriptResult(result,wasThrown);}},_printRunScriptResult:function(result,wasThrown)
9504 {var level=(wasThrown?WebInspector.ConsoleMessage.MessageLevel.Error:WebInspector.ConsoleMessage.MessageLevel.Log);var message=WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.JS,level,"",undefined,undefined,undefined,undefined,undefined,[result]);WebInspector.console.addMessage(message)},_rawLocationToUILocation:function(rawLocation)
9505 {var uiSourceCode=this._uiSourceCodeForScriptId[rawLocation.scriptId];if(!uiSourceCode)
9506 return null;return new WebInspector.UILocation(uiSourceCode,rawLocation.lineNumber,rawLocation.columnNumber||0);},_uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
9507 {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
9508 return null;return WebInspector.debuggerModel.createRawLocation(script,lineNumber,columnNumber);},_addScript:function(script)
9509 {var snippetId=this._snippetIdForSourceURL(script.sourceURL);if(!snippetId)
9510 return;var uiSourceCode=this._uiSourceCodeForSnippetId[snippetId];if(!uiSourceCode||this._evaluationSourceURL(uiSourceCode)!==script.sourceURL)
9511 return;console.assert(!this._scriptForUISourceCode.get(uiSourceCode));this._uiSourceCodeForScriptId[script.scriptId]=uiSourceCode;this._scriptForUISourceCode.put(uiSourceCode,script);uiSourceCode.scriptFile().setHasDivergedFromVM(false);script.pushSourceMapping(this._snippetScriptMapping);},_removeBreakpoints:function(uiSourceCode)
9512 {var breakpointLocations=WebInspector.breakpointManager.breakpointLocationsForUISourceCode(uiSourceCode);for(var i=0;i<breakpointLocations.length;++i)
9513 breakpointLocations[i].breakpoint.remove();return breakpointLocations;},_restoreBreakpoints:function(uiSourceCode,breakpointLocations)
9514 {for(var i=0;i<breakpointLocations.length;++i){var uiLocation=breakpointLocations[i].uiLocation;var breakpoint=breakpointLocations[i].breakpoint;WebInspector.breakpointManager.setBreakpoint(uiSourceCode,uiLocation.lineNumber,breakpoint.condition(),breakpoint.enabled());}},_releaseSnippetScript:function(uiSourceCode)
9515 {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
9516 return null;uiSourceCode.scriptFile().setIsDivergingFromVM(true);uiSourceCode.scriptFile().setHasDivergedFromVM(true);delete this._uiSourceCodeForScriptId[script.scriptId];this._scriptForUISourceCode.remove(uiSourceCode);delete uiSourceCode._evaluationIndex;uiSourceCode.scriptFile().setIsDivergingFromVM(false);},_debuggerReset:function()
9517 {for(var snippetId in this._uiSourceCodeForSnippetId){var uiSourceCode=this._uiSourceCodeForSnippetId[snippetId];this._releaseSnippetScript(uiSourceCode);}},_evaluationSourceURL:function(uiSourceCode)
9518 {var evaluationSuffix="_"+uiSourceCode._evaluationIndex;var snippetId=this._snippetIdForUISourceCode.get(uiSourceCode);return WebInspector.Script.snippetSourceURLPrefix+snippetId+evaluationSuffix;},_snippetIdForSourceURL:function(sourceURL)
9519 {var snippetPrefix=WebInspector.Script.snippetSourceURLPrefix;if(!sourceURL.startsWith(snippetPrefix))
9520 return null;var splitURL=sourceURL.substring(snippetPrefix.length).split("_");var snippetId=splitURL[0];return snippetId;},reset:function()
9521 {this._uiSourceCodeForScriptId={};this._scriptForUISourceCode=new Map();this._uiSourceCodeForSnippetId={};this._snippetIdForUISourceCode=new Map();this._projectDelegate.reset();this._loadSnippets();},__proto__:WebInspector.Object.prototype}
9522 WebInspector.SnippetScriptFile=function(scriptSnippetModel,uiSourceCode)
9523 {WebInspector.ScriptFile.call(this);this._scriptSnippetModel=scriptSnippetModel;this._uiSourceCode=uiSourceCode;this._hasDivergedFromVM=true;this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);}
9524 WebInspector.SnippetScriptFile.prototype={hasDivergedFromVM:function()
9525 {return this._hasDivergedFromVM;},setHasDivergedFromVM:function(hasDivergedFromVM)
9526 {this._hasDivergedFromVM=hasDivergedFromVM;},isDivergingFromVM:function()
9527 {return this._isDivergingFromVM;},checkMapping:function()
9528 {},isMergingToVM:function()
9529 {return false;},setIsDivergingFromVM:function(isDivergingFromVM)
9530 {this._isDivergingFromVM=isDivergingFromVM;},_workingCopyChanged:function()
9531 {this._scriptSnippetModel._scriptSnippetEdited(this._uiSourceCode);},__proto__:WebInspector.Object.prototype}
9532 WebInspector.SnippetScriptMapping=function(scriptSnippetModel)
9533 {this._scriptSnippetModel=scriptSnippetModel;}
9534 WebInspector.SnippetScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
9535 {var debuggerModelLocation=(rawLocation);return this._scriptSnippetModel._rawLocationToUILocation(debuggerModelLocation);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
9536 {return this._scriptSnippetModel._uiLocationToRawLocation(uiSourceCode,lineNumber,columnNumber);},snippetIdForSourceURL:function(sourceURL)
9537 {return this._scriptSnippetModel._snippetIdForSourceURL(sourceURL);},addScript:function(script)
9538 {this._scriptSnippetModel._addScript(script);}}
9539 WebInspector.SnippetContentProvider=function(snippet)
9540 {this._snippet=snippet;}
9541 WebInspector.SnippetContentProvider.prototype={contentURL:function()
9542 {return"";},contentType:function()
9543 {return WebInspector.resourceTypes.Script;},requestContent:function(callback)
9544 {callback(this._snippet.content);},searchInContent:function(query,caseSensitive,isRegex,callback)
9545 {function performSearch()
9546 {callback(WebInspector.ContentProvider.performSearchInContent(this._snippet.content,query,caseSensitive,isRegex));}
9547 window.setTimeout(performSearch.bind(this),0);}}
9548 WebInspector.SnippetsProjectDelegate=function(model)
9549 {WebInspector.ContentProviderBasedProjectDelegate.call(this,WebInspector.projectTypes.Snippets);this._model=model;}
9550 WebInspector.SnippetsProjectDelegate.prototype={id:function()
9551 {return WebInspector.projectTypes.Snippets+":";},addSnippet:function(name,contentProvider)
9552 {return this.addContentProvider("",name,name,contentProvider,true,false);},canSetFileContent:function()
9553 {return true;},setFileContent:function(path,newContent,callback)
9554 {this._model._setScriptSnippetContent(path,newContent);callback("");},canRename:function()
9555 {return true;},performRename:function(path,newName,callback)
9556 {this._model.renameScriptSnippet(path,newName,callback);},createFile:function(path,name,content,callback)
9557 {var filePath=this._model.createScriptSnippet(content);callback(filePath);},deleteFile:function(path)
9558 {this._model.deleteScriptSnippet(path);},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
9559 WebInspector.scriptSnippetModel;WebInspector.Progress=function()
9560 {}
9561 WebInspector.Progress.Events={Canceled:"Canceled"}
9562 WebInspector.Progress.prototype={setTotalWork:function(totalWork){},setTitle:function(title){},setWorked:function(worked,title){},worked:function(worked){},done:function(){},isCanceled:function(){return false;},addEventListener:function(eventType,listener,thisObject){}}
9563 WebInspector.CompositeProgress=function(parent)
9564 {this._parent=parent;this._children=[];this._childrenDone=0;this._parent.setTotalWork(1);this._parent.setWorked(0);parent.addEventListener(WebInspector.Progress.Events.Canceled,this._parentCanceled.bind(this));}
9565 WebInspector.CompositeProgress.prototype={_childDone:function()
9566 {if(++this._childrenDone===this._children.length)
9567 this._parent.done();},_parentCanceled:function()
9568 {this.dispatchEventToListeners(WebInspector.Progress.Events.Canceled);for(var i=0;i<this._children.length;++i){this._children[i].dispatchEventToListeners(WebInspector.Progress.Events.Canceled);}},createSubProgress:function(weight)
9569 {var child=new WebInspector.SubProgress(this,weight);this._children.push(child);return child;},_update:function()
9570 {var totalWeights=0;var done=0;for(var i=0;i<this._children.length;++i){var child=this._children[i];if(child._totalWork)
9571 done+=child._weight*child._worked/child._totalWork;totalWeights+=child._weight;}
9572 this._parent.setWorked(done/totalWeights);},__proto__:WebInspector.Object.prototype}
9573 WebInspector.SubProgress=function(composite,weight)
9574 {this._composite=composite;this._weight=weight||1;this._worked=0;}
9575 WebInspector.SubProgress.prototype={isCanceled:function()
9576 {return this._composite._parent.isCanceled();},setTitle:function(title)
9577 {this._composite._parent.setTitle(title);},done:function()
9578 {this.setWorked(this._totalWork);this._composite._childDone();},setTotalWork:function(totalWork)
9579 {this._totalWork=totalWork;this._composite._update();},setWorked:function(worked,title)
9580 {this._worked=worked;if(typeof title!=="undefined")
9581 this.setTitle(title);this._composite._update();},worked:function(worked)
9582 {this.setWorked(this._worked+(worked||1));},__proto__:WebInspector.Object.prototype}
9583 WebInspector.ProgressIndicator=function()
9584 {this.element=document.createElement("div");this.element.className="progress-bar-container";this._labelElement=this.element.createChild("span");this._progressElement=this.element.createChild("progress");this._stopButton=new WebInspector.StatusBarButton(WebInspector.UIString("Cancel"),"progress-bar-stop-button");this._stopButton.addEventListener("click",this.cancel,this);this.element.appendChild(this._stopButton.element);this._isCanceled=false;this._worked=0;}
9585 WebInspector.ProgressIndicator.Events={Done:"Done"}
9586 WebInspector.ProgressIndicator.prototype={show:function(parent)
9587 {parent.appendChild(this.element);},hide:function()
9588 {var parent=this.element.parentElement;if(parent)
9589 parent.removeChild(this.element);},done:function()
9590 {if(this._isDone)
9591 return;this._isDone=true;this.hide();this.dispatchEventToListeners(WebInspector.ProgressIndicator.Events.Done);},cancel:function()
9592 {this._isCanceled=true;this.dispatchEventToListeners(WebInspector.Progress.Events.Canceled);},isCanceled:function()
9593 {return this._isCanceled;},setTitle:function(title)
9594 {this._labelElement.textContent=title;},setTotalWork:function(totalWork)
9595 {this._progressElement.max=totalWork;},setWorked:function(worked,title)
9596 {this._worked=worked;this._progressElement.value=worked;if(title)
9597 this.setTitle(title);},worked:function(worked)
9598 {this.setWorked(this._worked+(worked||1));},__proto__:WebInspector.Object.prototype}
9599 WebInspector.StylesSourceMapping=function(cssModel,workspace)
9600 {this._cssModel=cssModel;this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset,this._projectWillReset,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated,this._mainFrameCreatedOrNavigated,this);this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged,this._styleSheetChanged,this);this._initialize();}
9601 WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs=1000;WebInspector.StylesSourceMapping.prototype={rawLocationToUILocation:function(rawLocation)
9602 {var location=(rawLocation);var uiSourceCode=this._workspace.uiSourceCodeForURL(location.url);if(!uiSourceCode)
9603 return null;return new WebInspector.UILocation(uiSourceCode,location.lineNumber,location.columnNumber);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
9604 {return new WebInspector.CSSLocation(uiSourceCode.url||"",lineNumber,columnNumber);},addHeader:function(header)
9605 {var url=header.resourceURL();if(!url)
9606 return;header.pushSourceMapping(this);var map=this._urlToHeadersByFrameId[url];if(!map){map=(new StringMap());this._urlToHeadersByFrameId[url]=map;}
9607 var headersById=map.get(header.frameId);if(!headersById){headersById=(new StringMap());map.put(header.frameId,headersById);}
9608 headersById.put(header.id,header);var uiSourceCode=this._workspace.uiSourceCodeForURL(url);if(uiSourceCode)
9609 this._bindUISourceCode(uiSourceCode,header);},removeHeader:function(header)
9610 {var url=header.resourceURL();if(!url)
9611 return;var map=this._urlToHeadersByFrameId[url];console.assert(map);var headersById=map.get(header.frameId);console.assert(headersById);headersById.remove(header.id);if(!headersById.size()){map.remove(header.frameId);if(!map.size()){delete this._urlToHeadersByFrameId[url];var uiSourceCode=this._workspace.uiSourceCodeForURL(url);if(uiSourceCode)
9612 this._unbindUISourceCode(uiSourceCode);}}},_unbindUISourceCode:function(uiSourceCode)
9613 {var styleFile=this._styleFiles.get(uiSourceCode);if(!styleFile)
9614 return;styleFile.dispose();this._styleFiles.remove(uiSourceCode);},_uiSourceCodeAddedToWorkspace:function(event)
9615 {var uiSourceCode=(event.data);var url=uiSourceCode.url;if(!url||!this._urlToHeadersByFrameId[url])
9616 return;this._bindUISourceCode(uiSourceCode,this._urlToHeadersByFrameId[url].values()[0].values()[0]);},_bindUISourceCode:function(uiSourceCode,header)
9617 {if(this._styleFiles.get(uiSourceCode)||header.isInline)
9618 return;var url=uiSourceCode.url;this._styleFiles.put(uiSourceCode,new WebInspector.StyleFile(uiSourceCode,this));header.updateLocations();},_projectWillReset:function(event)
9619 {var project=(event.data);var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
9620 this._unbindUISourceCode(uiSourceCodes[i]);},_uiSourceCodeRemoved:function(event)
9621 {var uiSourceCode=(event.data);this._unbindUISourceCode(uiSourceCode);},_initialize:function()
9622 {this._urlToHeadersByFrameId={};this._styleFiles=new Map();},_mainFrameCreatedOrNavigated:function(event)
9623 {for(var url in this._urlToHeadersByFrameId){var uiSourceCode=this._workspace.uiSourceCodeForURL(url);if(!uiSourceCode)
9624 continue;this._unbindUISourceCode(uiSourceCode);}
9625 this._initialize();},_setStyleContent:function(uiSourceCode,content,majorChange,userCallback)
9626 {var styleSheetIds=this._cssModel.styleSheetIdsForURL(uiSourceCode.url);if(!styleSheetIds.length){userCallback("No stylesheet found: "+uiSourceCode.url);return;}
9627 this._isSettingContent=true;function callback(error)
9628 {userCallback(error);delete this._isSettingContent;}
9629 this._cssModel.setStyleSheetText(styleSheetIds[0],content,majorChange,callback.bind(this));},_styleSheetChanged:function(event)
9630 {if(this._isSettingContent)
9631 return;if(event.data.majorChange){this._updateStyleSheetText(event.data.styleSheetId);return;}
9632 this._updateStyleSheetTextSoon(event.data.styleSheetId);},_updateStyleSheetTextSoon:function(styleSheetId)
9633 {if(this._updateStyleSheetTextTimer)
9634 clearTimeout(this._updateStyleSheetTextTimer);this._updateStyleSheetTextTimer=setTimeout(this._updateStyleSheetText.bind(this,styleSheetId),WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs);},_updateStyleSheetText:function(styleSheetId)
9635 {if(this._updateStyleSheetTextTimer){clearTimeout(this._updateStyleSheetTextTimer);delete this._updateStyleSheetTextTimer;}
9636 var header=this._cssModel.styleSheetHeaderForId(styleSheetId);if(!header)
9637 return;var styleSheetURL=header.resourceURL();if(!styleSheetURL)
9638 return;var uiSourceCode=this._workspace.uiSourceCodeForURL(styleSheetURL)
9639 if(!uiSourceCode)
9640 return;header.requestContent(callback.bind(this,uiSourceCode));function callback(uiSourceCode,content)
9641 {var styleFile=this._styleFiles.get(uiSourceCode);if(styleFile)
9642 styleFile.addRevision(content||"");}}}
9643 WebInspector.StyleFile=function(uiSourceCode,mapping)
9644 {this._uiSourceCode=uiSourceCode;this._mapping=mapping;this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);}
9645 WebInspector.StyleFile.updateTimeout=200;WebInspector.StyleFile.prototype={_workingCopyCommitted:function(event)
9646 {if(this._isAddingRevision)
9647 return;this._commitIncrementalEdit(true);},_workingCopyChanged:function(event)
9648 {if(this._isAddingRevision)
9649 return;if(WebInspector.StyleFile.updateTimeout>=0){this._incrementalUpdateTimer=setTimeout(this._commitIncrementalEdit.bind(this,false),WebInspector.StyleFile.updateTimeout)}else
9650 this._commitIncrementalEdit(false);},_commitIncrementalEdit:function(majorChange)
9651 {this._clearIncrementalUpdateTimer();this._mapping._setStyleContent(this._uiSourceCode,this._uiSourceCode.workingCopy(),majorChange,this._styleContentSet.bind(this));},_styleContentSet:function(error)
9652 {if(error)
9653 WebInspector.showErrorMessage(error);},_clearIncrementalUpdateTimer:function()
9654 {if(!this._incrementalUpdateTimer)
9655 return;clearTimeout(this._incrementalUpdateTimer);delete this._incrementalUpdateTimer;},addRevision:function(content)
9656 {this._isAddingRevision=true;this._uiSourceCode.addRevision(content);delete this._isAddingRevision;},dispose:function()
9657 {this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);}}
9658 WebInspector.NetworkUISourceCodeProvider=function(networkWorkspaceProvider,workspace)
9659 {this._networkWorkspaceProvider=networkWorkspaceProvider;this._workspace=workspace;WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,this._resourceAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._processedURLs={};}
9660 WebInspector.NetworkUISourceCodeProvider.prototype={_populate:function()
9661 {function populateFrame(frame)
9662 {for(var i=0;i<frame.childFrames.length;++i)
9663 populateFrame.call(this,frame.childFrames[i]);var resources=frame.resources();for(var i=0;i<resources.length;++i)
9664 this._resourceAdded({data:resources[i]});}
9665 populateFrame.call(this,WebInspector.resourceTreeModel.mainFrame);},_parsedScriptSource:function(event)
9666 {var script=(event.data);if(!script.sourceURL||script.isInlineScript()||script.isSnippet())
9667 return;if(script.isContentScript&&!script.hasSourceURL){var parsedURL=new WebInspector.ParsedURL(script.sourceURL);if(!parsedURL.isValid)
9668 return;}
9669 this._addFile(script.sourceURL,script,script.isContentScript);},_styleSheetAdded:function(event)
9670 {var header=(event.data);if((!header.hasSourceURL||header.isInline)&&header.origin!=="inspector")
9671 return;this._addFile(header.resourceURL(),header,false);},_resourceAdded:function(event)
9672 {var resource=(event.data);this._addFile(resource.url,resource);},_mainFrameNavigated:function(event)
9673 {this._reset();},_addFile:function(url,contentProvider,isContentScript)
9674 {if(this._workspace.hasMappingForURL(url))
9675 return;var type=contentProvider.contentType();if(type!==WebInspector.resourceTypes.Stylesheet&&type!==WebInspector.resourceTypes.Document&&type!==WebInspector.resourceTypes.Script)
9676 return;if(this._processedURLs[url])
9677 return;this._processedURLs[url]=true;var isEditable=type!==WebInspector.resourceTypes.Document;this._networkWorkspaceProvider.addFileForURL(url,contentProvider,isEditable,isContentScript);},_reset:function()
9678 {this._processedURLs={};this._networkWorkspaceProvider.reset();this._populate();}}
9679 WebInspector.networkWorkspaceProvider;WebInspector.ElementsPanelDescriptor=function()
9680 {WebInspector.moduleManager.registerModule({name:"ElementsPanel",extensions:[{type:"@WebInspector.Panel",name:"elements",title:"Elements",order:0,className:"WebInspector.ElementsPanel"},{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.RemoteObject","WebInspector.DOMNode"],className:"WebInspector.ElementsPanel.ContextMenuProvider"},{type:"@WebInspector.Drawer.ViewFactory",name:"emulation",title:"Emulation",order:"10",setting:"showEmulationViewInDrawer",className:"WebInspector.ElementsPanel.OverridesViewFactory"},{type:"@WebInspector.Drawer.ViewFactory",name:"rendering",title:"Rendering",order:"11",setting:"showRenderingViewInDrawer",className:"WebInspector.ElementsPanel.RenderingViewFactory"}],scripts:["ElementsPanel.js"]});}
9681 WebInspector.NetworkPanelDescriptor=function()
9682 {WebInspector.moduleManager.registerModule({name:"NetworkPanel",extensions:[{type:"@WebInspector.Panel",name:"network",title:"Network",order:1,className:"WebInspector.NetworkPanel"},{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.NetworkRequest","WebInspector.Resource","WebInspector.UISourceCode"],className:"WebInspector.NetworkPanel.ContextMenuProvider"}],scripts:["NetworkPanel.js"]});}
9683 WebInspector.CPUProfilerModel=function()
9684 {this._delegate=null;this._isRecording=false;InspectorBackend.registerProfilerDispatcher(this);ProfilerAgent.enable();}
9685 WebInspector.CPUProfilerModel.EventTypes={ProfileStarted:"profile-started",ProfileStopped:"profile-stopped"};WebInspector.CPUProfilerModel.prototype={setDelegate:function(delegate)
9686 {this._delegate=delegate;},consoleProfileFinished:function(id,scriptLocation,cpuProfile,title)
9687 {WebInspector.inspectorView.panel("profiles");this._delegate.consoleProfileFinished(id,scriptLocation,cpuProfile,title);},consoleProfileStarted:function(id,scriptLocation,title)
9688 {WebInspector.inspectorView.panel("profiles");this._delegate.consoleProfileStarted(id,scriptLocation,title);},setRecording:function(isRecording)
9689 {this._isRecording=isRecording;this.dispatchEventToListeners(isRecording?WebInspector.CPUProfilerModel.EventTypes.ProfileStarted:WebInspector.CPUProfilerModel.EventTypes.ProfileStopped);},isRecordingProfile:function()
9690 {return this._isRecording;},__proto__:WebInspector.Object.prototype}
9691 WebInspector.CPUProfilerModel.ProfileURLRegExp=/webkit-profile:\/\/(.+)\/(.+)/;WebInspector.CPUProfilerModel.Delegate=function(){};WebInspector.CPUProfilerModel.Delegate.prototype={consoleProfileStarted:function(protocolId,scriptLocation,title){},consoleProfileFinished:function(protocolId,scriptLocation,cpuProfile,title){}}
9692 WebInspector.cpuProfilerModel;WebInspector.ProfilesPanelDescriptor=function()
9693 {WebInspector.moduleManager.registerModule({name:"ProfilesPanel",extensions:[{type:"@WebInspector.Panel",name:"profiles",title:"Profiles",order:4,className:"WebInspector.ProfilesPanel"},{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.RemoteObject"],className:"WebInspector.ProfilesPanel.ContextMenuProvider"}],scripts:["ProfilesPanel.js"]});}
9694 WebInspector.SourcesPanelDescriptor=function()
9695 {WebInspector.moduleManager.registerModule({name:"SourcesPanel",extensions:[{type:"@WebInspector.Panel",name:"sources",title:"Sources",order:2,className:"WebInspector.SourcesPanel"},{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.UISourceCode","WebInspector.RemoteObject"],className:"WebInspector.SourcesPanel.ContextMenuProvider"},{type:"@WebInspector.SearchScope",className:"WebInspector.SourcesSearchScope"},{type:"@WebInspector.Drawer.ViewFactory",name:"search",title:"Search",order:"1",className:"WebInspector.AdvancedSearchController.ViewFactory"}],scripts:["SourcesPanel.js"]});}
9696 WebInspector.TimelinePanelDescriptor=function()
9697 {WebInspector.moduleManager.registerModule({name:"TimelinePanel",extensions:[{type:"@WebInspector.Panel",name:"timeline",title:"Timeline",order:3,className:"WebInspector.TimelinePanel"}],scripts:["TimelinePanel.js"]});}
9698 WebInspector.AuditsPanelDescriptor=function()
9699 {WebInspector.moduleManager.registerModule({name:"AuditsPanel",extensions:[{type:"@WebInspector.Panel",name:"audits",title:"Audits",order:6,className:"WebInspector.AuditsPanel"}],scripts:["AuditsPanel.js"]});}
9700 WebInspector.LayersPanelDescriptor=function()
9701 {WebInspector.moduleManager.registerModule({name:"LayersPanel",extensions:[{type:"@WebInspector.Panel",name:"layers",title:"Layers",className:"WebInspector.LayersPanel"}],scripts:["LayersPanel.js"]});}
9702 WebInspector.DockController=function()
9703 {if(!WebInspector.queryParamsObject["can_dock"]){this._dockSide=WebInspector.DockController.State.Undocked;this._updateUI();return;}
9704 WebInspector.settings.currentDockState=WebInspector.settings.createSetting("currentDockState","");WebInspector.settings.lastDockState=WebInspector.settings.createSetting("lastDockState","");this._dockToggleButton=new WebInspector.StatusBarStatesSettingButton("dock-status-bar-item",[WebInspector.DockController.State.DockedToBottom,WebInspector.DockController.State.Undocked,WebInspector.DockController.State.DockedToRight],[WebInspector.UIString("Dock to main window."),WebInspector.UIString("Undock into separate window."),WebInspector.UIString("Dock to main window.")],WebInspector.settings.currentDockState,WebInspector.settings.lastDockState,this._dockSideChanged.bind(this));}
9705 WebInspector.DockController.State={DockedToBottom:"bottom",DockedToRight:"right",Undocked:"undocked"}
9706 WebInspector.DockController.Events={DockSideChanged:"DockSideChanged"}
9707 WebInspector.DockController.prototype={get element()
9708 {return WebInspector.queryParamsObject["can_dock"]?this._dockToggleButton.element:null;},dockSide:function()
9709 {return this._dockSide;},_dockSideChanged:function(dockSide)
9710 {if(this._dockSide===dockSide)
9711 return;this._dockSide=dockSide;if(WebInspector.queryParamsObject["can_dock"])
9712 InspectorFrontendHost.requestSetDockSide(dockSide);this._updateUI();this.dispatchEventToListeners(WebInspector.DockController.Events.DockSideChanged,this._dockSide);},_updateUI:function()
9713 {var body=document.body;switch(this._dockSide){case WebInspector.DockController.State.DockedToBottom:body.classList.remove("undocked");body.classList.remove("dock-to-right");body.classList.add("dock-to-bottom");break;case WebInspector.DockController.State.DockedToRight:body.classList.remove("undocked");body.classList.add("dock-to-right");body.classList.remove("dock-to-bottom");break;case WebInspector.DockController.State.Undocked:body.classList.add("undocked");body.classList.remove("dock-to-right");body.classList.remove("dock-to-bottom");break;}},__proto__:WebInspector.Object.prototype}
9714 WebInspector.dockController;WebInspector.TracingAgent=function()
9715 {this._active=false;InspectorBackend.registerTracingDispatcher(new WebInspector.TracingDispatcher(this));}
9716 WebInspector.TracingAgent.prototype={start:function(categoryPatterns,options,callback)
9717 {TracingAgent.start(categoryPatterns,options,callback);this._active=true;this._events=[];},stop:function(callback)
9718 {if(!this._active){callback();return;}
9719 this._pendingStopCallback=callback;TracingAgent.end();},events:function()
9720 {return this._events;},_eventsCollected:function(events)
9721 {Array.prototype.push.apply(this._events,events);},_tracingComplete:function()
9722 {this._active=false;if(this._pendingStopCallback){this._pendingStopCallback();this._pendingStopCallback=null;}}}
9723 WebInspector.TracingDispatcher=function(tracingAgent)
9724 {this._tracingAgent=tracingAgent;}
9725 WebInspector.TracingDispatcher.prototype={dataCollected:function(data)
9726 {this._tracingAgent._eventsCollected(data);},tracingComplete:function()
9727 {this._tracingAgent._tracingComplete();}}
9728 WebInspector.tracingAgent;WebInspector.ScreencastView=function(statusBarButtonPlaceholder)
9729 {WebInspector.View.call(this);this.registerRequiredCSS("screencastView.css");this._statusBarButtonPlaceholder=statusBarButtonPlaceholder;}
9730 WebInspector.ScreencastView._bordersSize=40;WebInspector.ScreencastView._navBarHeight=29;WebInspector.ScreencastView._HttpRegex=/^https?:\/\/(.+)/;WebInspector.ScreencastView.prototype={initialize:function()
9731 {this.element.classList.add("fill");this.element.classList.add("screencast");this._createNavigationBar();this._viewportElement=this.element.createChild("div","screencast-viewport hidden");this._glassPaneElement=this.element.createChild("div","screencast-glasspane hidden");this._canvasElement=this._viewportElement.createChild("canvas");this._canvasElement.tabIndex=1;this._canvasElement.addEventListener("mousedown",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("mouseup",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("mousemove",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("mousewheel",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("click",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),false);this._canvasElement.addEventListener("keydown",this._handleKeyEvent.bind(this),false);this._canvasElement.addEventListener("keyup",this._handleKeyEvent.bind(this),false);this._canvasElement.addEventListener("keypress",this._handleKeyEvent.bind(this),false);this._titleElement=this._viewportElement.createChild("div","screencast-element-title monospace hidden");this._tagNameElement=this._titleElement.createChild("span","screencast-tag-name");this._nodeIdElement=this._titleElement.createChild("span","screencast-node-id");this._classNameElement=this._titleElement.createChild("span","screencast-class-name");this._titleElement.appendChild(document.createTextNode(" "));this._nodeWidthElement=this._titleElement.createChild("span");this._titleElement.createChild("span","screencast-px").textContent="px";this._titleElement.appendChild(document.createTextNode(" \u00D7 "));this._nodeHeightElement=this._titleElement.createChild("span");this._titleElement.createChild("span","screencast-px").textContent="px";this._imageElement=new Image();this._isCasting=false;this._context=this._canvasElement.getContext("2d");this._checkerboardPattern=this._createCheckerboardPattern(this._context);this._shortcuts=({});this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l",WebInspector.KeyboardShortcut.Modifiers.Ctrl)]=this._focusNavigationBar.bind(this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame,this._screencastFrame,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastVisibilityChanged,this._screencastVisibilityChanged,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted,this._onTimeline.bind(this,true),this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStopped,this._onTimeline.bind(this,false),this);this._timelineActive=WebInspector.timelineManager.isStarted();WebInspector.cpuProfilerModel.addEventListener(WebInspector.CPUProfilerModel.EventTypes.ProfileStarted,this._onProfiler.bind(this,true),this);WebInspector.cpuProfilerModel.addEventListener(WebInspector.CPUProfilerModel.EventTypes.ProfileStopped,this._onProfiler.bind(this,false),this);this._profilerActive=WebInspector.cpuProfilerModel.isRecordingProfile();this._updateGlasspane();this._currentScreencastState=WebInspector.settings.createSetting("currentScreencastState","");this._lastScreencastState=WebInspector.settings.createSetting("lastScreencastState","");this._toggleScreencastButton=new WebInspector.StatusBarStatesSettingButton("screencast-status-bar-item",["disabled","left","top"],[WebInspector.UIString("Disable screencast."),WebInspector.UIString("Switch to portrait screencast."),WebInspector.UIString("Switch to landscape screencast.")],this._currentScreencastState,this._lastScreencastState,this._toggleScreencastButtonClicked.bind(this));this._statusBarButtonPlaceholder.parentElement.insertBefore(this._toggleScreencastButton.element,this._statusBarButtonPlaceholder);this._statusBarButtonPlaceholder.parentElement.removeChild(this._statusBarButtonPlaceholder);},_toggleScreencastButtonClicked:function(state)
9732 {if(state==="disabled")
9733 WebInspector.inspectorView.hideScreencastView();else
9734 WebInspector.inspectorView.showScreencastView(this,state==="left");},wasShown:function()
9735 {this._startCasting();},willHide:function()
9736 {this._stopCasting();},_startCasting:function()
9737 {if(this._timelineActive||this._profilerActive)
9738 return;if(this._isCasting)
9739 return;this._isCasting=true;const maxImageDimension=1024;var dimensions=this._viewportDimensions();if(dimensions.width<0||dimensions.height<0){this._isCasting=false;return;}
9740 dimensions.width*=WebInspector.zoomFactor();dimensions.height*=WebInspector.zoomFactor();PageAgent.startScreencast("jpeg",80,Math.min(maxImageDimension,dimensions.width),Math.min(maxImageDimension,dimensions.height));WebInspector.domAgent.setHighlighter(this);},_stopCasting:function()
9741 {if(!this._isCasting)
9742 return;this._isCasting=false;PageAgent.stopScreencast();WebInspector.domAgent.setHighlighter(null);},_screencastFrame:function(event)
9743 {var metadata=(event.data.metadata);if(!metadata.deviceScaleFactor){console.log(event.data.data);return;}
9744 var base64Data=(event.data.data);this._imageElement.src="data:image/jpg;base64,"+base64Data;this._deviceScaleFactor=metadata.deviceScaleFactor;this._pageScaleFactor=metadata.pageScaleFactor;this._viewport=metadata.viewport;if(!this._viewport)
9745 return;var offsetTop=metadata.offsetTop||0;var offsetBottom=metadata.offsetBottom||0;var screenWidthDIP=this._viewport.width*this._pageScaleFactor;var screenHeightDIP=this._viewport.height*this._pageScaleFactor+offsetTop+offsetBottom;this._screenOffsetTop=offsetTop;this._resizeViewport(screenWidthDIP,screenHeightDIP);this._imageZoom=this._imageElement.naturalWidth?this._canvasElement.offsetWidth/this._imageElement.naturalWidth:1;this.highlightDOMNode(this._highlightNodeId,this._highlightConfig);},_isGlassPaneActive:function()
9746 {return!this._glassPaneElement.classList.contains("hidden");},_screencastVisibilityChanged:function(event)
9747 {this._targetInactive=!event.data.visible;this._updateGlasspane();},_onTimeline:function(on)
9748 {this._timelineActive=on;if(this._timelineActive)
9749 this._stopCasting();else
9750 this._startCasting();this._updateGlasspane();},_onProfiler:function(on,event){this._profilerActive=on;if(this._profilerActive)
9751 this._stopCasting();else
9752 this._startCasting();this._updateGlasspane();},_updateGlasspane:function()
9753 {if(this._targetInactive){this._glassPaneElement.textContent=WebInspector.UIString("The tab is inactive");this._glassPaneElement.classList.remove("hidden");}else if(this._timelineActive){this._glassPaneElement.textContent=WebInspector.UIString("Timeline is active");this._glassPaneElement.classList.remove("hidden");}else if(this._profilerActive){this._glassPaneElement.textContent=WebInspector.UIString("CPU profiler is active");this._glassPaneElement.classList.remove("hidden");}else{this._glassPaneElement.classList.add("hidden");}},_resizeViewport:function(screenWidthDIP,screenHeightDIP)
9754 {var dimensions=this._viewportDimensions();this._screenZoom=Math.min(dimensions.width/screenWidthDIP,dimensions.height/screenHeightDIP);var bordersSize=WebInspector.ScreencastView._bordersSize;this._viewportElement.classList.remove("hidden");this._viewportElement.style.width=screenWidthDIP*this._screenZoom+bordersSize+"px";this._viewportElement.style.height=screenHeightDIP*this._screenZoom+bordersSize+"px";},_handleMouseEvent:function(event)
9755 {if(this._isGlassPaneActive()){event.consume();return;}
9756 if(!this._viewport)
9757 return;if(!this._inspectModeConfig||event.type==="mousewheel"){this._simulateTouchGestureForMouseEvent(event);event.preventDefault();if(event.type==="mousedown")
9758 this._canvasElement.focus();return;}
9759 var position=this._convertIntoScreenSpace(event);DOMAgent.getNodeForLocation(position.x/this._pageScaleFactor,position.y/this._pageScaleFactor,callback.bind(this));function callback(error,nodeId)
9760 {if(error)
9761 return;if(event.type==="mousemove")
9762 this.highlightDOMNode(nodeId,this._inspectModeConfig);else if(event.type==="click")
9763 WebInspector.domAgent.dispatchEventToListeners(WebInspector.DOMAgent.Events.InspectNodeRequested,nodeId);}},_handleKeyEvent:function(event)
9764 {if(this._isGlassPaneActive()){event.consume();return;}
9765 var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcutKey];if(handler&&handler(event)){event.consume();return;}
9766 var type;switch(event.type){case"keydown":type="keyDown";break;case"keyup":type="keyUp";break;case"keypress":type="char";break;default:return;}
9767 var text=event.type==="keypress"?String.fromCharCode(event.charCode):undefined;InputAgent.dispatchKeyEvent(type,this._modifiersForEvent(event),event.timeStamp/1000,text,text?text.toLowerCase():undefined,event.keyIdentifier,event.keyCode,event.keyCode,undefined,false,false,false);event.consume();this._canvasElement.focus();},_handleContextMenuEvent:function(event)
9768 {event.consume(true);},_simulateTouchGestureForMouseEvent:function(event)
9769 {var position=this._convertIntoScreenSpace(event);var timeStamp=event.timeStamp/1000;var x=position.x;var y=position.y;switch(event.which){case 1:if(event.type==="mousedown"){InputAgent.dispatchGestureEvent("scrollBegin",x,y,timeStamp);}else if(event.type==="mousemove"){var dx=this._lastScrollPosition?position.x-this._lastScrollPosition.x:0;var dy=this._lastScrollPosition?position.y-this._lastScrollPosition.y:0;if(dx||dy)
9770 InputAgent.dispatchGestureEvent("scrollUpdate",x,y,timeStamp,dx,dy);}else if(event.type==="mouseup"){InputAgent.dispatchGestureEvent("scrollEnd",x,y,timeStamp);}else if(event.type==="mousewheel"){if(event.altKey){var factor=1.1;var scale=event.wheelDeltaY<0?1/factor:factor;InputAgent.dispatchGestureEvent("pinchBegin",x,y,timeStamp);InputAgent.dispatchGestureEvent("pinchUpdate",x,y,timeStamp,0,0,scale);InputAgent.dispatchGestureEvent("pinchEnd",x,y,timeStamp);}else{InputAgent.dispatchGestureEvent("scrollBegin",x,y,timeStamp);InputAgent.dispatchGestureEvent("scrollUpdate",x,y,timeStamp,event.wheelDeltaX,event.wheelDeltaY);InputAgent.dispatchGestureEvent("scrollEnd",x,y,timeStamp);}}else if(event.type==="click"){InputAgent.dispatchMouseEvent("mousePressed",x,y,0,timeStamp,"left",1,true);InputAgent.dispatchMouseEvent("mouseReleased",x,y,0,timeStamp,"left",1,true);}
9771 this._lastScrollPosition=position;break;case 2:if(event.type==="mousedown"){InputAgent.dispatchGestureEvent("tapDown",x,y,timeStamp);}else if(event.type==="mouseup"){InputAgent.dispatchGestureEvent("tap",x,y,timeStamp);}
9772 break;case 3:if(event.type==="mousedown"){this._pinchStart=position;InputAgent.dispatchGestureEvent("pinchBegin",x,y,timeStamp);}else if(event.type==="mousemove"){var dx=this._pinchStart?position.x-this._pinchStart.x:0;var dy=this._pinchStart?position.y-this._pinchStart.y:0;if(dx||dy){var scale=Math.pow(dy<0?0.999:1.001,Math.abs(dy));InputAgent.dispatchGestureEvent("pinchUpdate",this._pinchStart.x,this._pinchStart.y,timeStamp,0,0,scale);}}else if(event.type==="mouseup"){InputAgent.dispatchGestureEvent("pinchEnd",x,y,timeStamp);}
9773 break;case 0:default:}},_convertIntoScreenSpace:function(event)
9774 {var zoom=this._canvasElement.offsetWidth/this._viewport.width/this._pageScaleFactor;var position={};position.x=Math.round(event.offsetX/zoom);position.y=Math.round(event.offsetY/zoom-this._screenOffsetTop);return position;},_modifiersForEvent:function(event)
9775 {var modifiers=0;if(event.altKey)
9776 modifiers=1;if(event.ctrlKey)
9777 modifiers+=2;if(event.metaKey)
9778 modifiers+=4;if(event.shiftKey)
9779 modifiers+=8;return modifiers;},onResize:function()
9780 {if(this._deferredCasting){clearTimeout(this._deferredCasting);delete this._deferredCasting;}
9781 this._stopCasting();this._deferredCasting=setTimeout(this._startCasting.bind(this),100);},highlightDOMNode:function(nodeId,config,objectId)
9782 {this._highlightNodeId=nodeId;this._highlightConfig=config;if(!nodeId){this._model=null;this._config=null;this._node=null;this._titleElement.classList.add("hidden");this._repaint();return;}
9783 this._node=WebInspector.domAgent.nodeForId(nodeId);DOMAgent.getBoxModel(nodeId,callback.bind(this));function callback(error,model)
9784 {if(error){this._repaint();return;}
9785 this._model=this._scaleModel(model);this._config=config;this._repaint();}},_scaleModel:function(model)
9786 {var scale=this._canvasElement.offsetWidth/this._viewport.width;function scaleQuad(quad)
9787 {for(var i=0;i<quad.length;i+=2){quad[i]=(quad[i]-this._viewport.x)*scale;quad[i+1]=(quad[i+1]-this._viewport.y)*scale+this._screenOffsetTop*this._screenZoom;}}
9788 scaleQuad.call(this,model.content);scaleQuad.call(this,model.padding);scaleQuad.call(this,model.border);scaleQuad.call(this,model.margin);return model;},_repaint:function()
9789 {var model=this._model;var config=this._config;this._canvasElement.width=window.devicePixelRatio*this._canvasElement.offsetWidth;this._canvasElement.height=window.devicePixelRatio*this._canvasElement.offsetHeight;this._context.save();this._context.scale(window.devicePixelRatio,window.devicePixelRatio);this._context.save();this._context.fillStyle=this._checkerboardPattern;this._context.fillRect(0,0,this._canvasElement.offsetWidth,this._screenOffsetTop*this._screenZoom);this._context.fillRect(0,this._screenOffsetTop*this._screenZoom+this._imageElement.naturalHeight*this._imageZoom,this._canvasElement.offsetWidth,this._canvasElement.offsetHeight);this._context.restore();if(model&&config){this._context.save();const transparentColor="rgba(0, 0, 0, 0)";var hasContent=model.content&&config.contentColor!==transparentColor;var hasPadding=model.padding&&config.paddingColor!==transparentColor;var hasBorder=model.border&&config.borderColor!==transparentColor;var hasMargin=model.margin&&config.marginColor!==transparentColor;var clipQuad;if(hasMargin&&(!hasBorder||!this._quadsAreEqual(model.margin,model.border))){this._drawOutlinedQuadWithClip(model.margin,model.border,config.marginColor);clipQuad=model.border;}
9790 if(hasBorder&&(!hasPadding||!this._quadsAreEqual(model.border,model.padding))){this._drawOutlinedQuadWithClip(model.border,model.padding,config.borderColor);clipQuad=model.padding;}
9791 if(hasPadding&&(!hasContent||!this._quadsAreEqual(model.padding,model.content))){this._drawOutlinedQuadWithClip(model.padding,model.content,config.paddingColor);clipQuad=model.content;}
9792 if(hasContent)
9793 this._drawOutlinedQuad(model.content,config.contentColor);this._context.restore();this._drawElementTitle();this._context.globalCompositeOperation="destination-over";}
9794 this._context.drawImage(this._imageElement,0,this._screenOffsetTop*this._screenZoom,this._imageElement.naturalWidth*this._imageZoom,this._imageElement.naturalHeight*this._imageZoom);this._context.restore();},_quadsAreEqual:function(quad1,quad2)
9795 {for(var i=0;i<quad1.length;++i){if(quad1[i]!==quad2[i])
9796 return false;}
9797 return true;},_cssColor:function(color)
9798 {if(!color)
9799 return"transparent";return WebInspector.Color.fromRGBA([color.r,color.g,color.b,color.a]).toString(WebInspector.Color.Format.RGBA)||"";},_quadToPath:function(quad)
9800 {this._context.beginPath();this._context.moveTo(quad[0],quad[1]);this._context.lineTo(quad[2],quad[3]);this._context.lineTo(quad[4],quad[5]);this._context.lineTo(quad[6],quad[7]);this._context.closePath();return this._context;},_drawOutlinedQuad:function(quad,fillColor)
9801 {this._context.save();this._context.lineWidth=2;this._quadToPath(quad).clip();this._context.fillStyle=this._cssColor(fillColor);this._context.fill();this._context.restore();},_drawOutlinedQuadWithClip:function(quad,clipQuad,fillColor)
9802 {this._context.fillStyle=this._cssColor(fillColor);this._context.save();this._context.lineWidth=0;this._quadToPath(quad).fill();this._context.globalCompositeOperation="destination-out";this._context.fillStyle="red";this._quadToPath(clipQuad).fill();this._context.restore();},_drawElementTitle:function()
9803 {if(!this._node)
9804 return;var canvasWidth=this._canvasElement.offsetWidth;var canvasHeight=this._canvasElement.offsetHeight;var lowerCaseName=this._node.localName()||this._node.nodeName().toLowerCase();this._tagNameElement.textContent=lowerCaseName;this._nodeIdElement.textContent=this._node.getAttribute("id")?"#"+this._node.getAttribute("id"):"";this._nodeIdElement.textContent=this._node.getAttribute("id")?"#"+this._node.getAttribute("id"):"";var className=this._node.getAttribute("class");if(className&&className.length>50)
9805 className=className.substring(0,50)+"\u2026";this._classNameElement.textContent=className||"";this._nodeWidthElement.textContent=this._model.width;this._nodeHeightElement.textContent=this._model.height;var marginQuad=this._model.margin;var titleWidth=this._titleElement.offsetWidth+6;var titleHeight=this._titleElement.offsetHeight+4;var anchorTop=this._model.margin[1];var anchorBottom=this._model.margin[7];const arrowHeight=7;var renderArrowUp=false;var renderArrowDown=false;var boxX=Math.max(2,this._model.margin[0]);if(boxX+titleWidth>canvasWidth)
9806 boxX=canvasWidth-titleWidth-2;var boxY;if(anchorTop>canvasHeight){boxY=canvasHeight-titleHeight-arrowHeight;renderArrowDown=true;}else if(anchorBottom<0){boxY=arrowHeight;renderArrowUp=true;}else if(anchorBottom+titleHeight+arrowHeight<canvasHeight){boxY=anchorBottom+arrowHeight-4;renderArrowUp=true;}else if(anchorTop-titleHeight-arrowHeight>0){boxY=anchorTop-titleHeight-arrowHeight+3;renderArrowDown=true;}else
9807 boxY=arrowHeight;this._context.save();this._context.translate(0.5,0.5);this._context.beginPath();this._context.moveTo(boxX,boxY);if(renderArrowUp){this._context.lineTo(boxX+2*arrowHeight,boxY);this._context.lineTo(boxX+3*arrowHeight,boxY-arrowHeight);this._context.lineTo(boxX+4*arrowHeight,boxY);}
9808 this._context.lineTo(boxX+titleWidth,boxY);this._context.lineTo(boxX+titleWidth,boxY+titleHeight);if(renderArrowDown){this._context.lineTo(boxX+4*arrowHeight,boxY+titleHeight);this._context.lineTo(boxX+3*arrowHeight,boxY+titleHeight+arrowHeight);this._context.lineTo(boxX+2*arrowHeight,boxY+titleHeight);}
9809 this._context.lineTo(boxX,boxY+titleHeight);this._context.closePath();this._context.fillStyle="rgb(255, 255, 194)";this._context.fill();this._context.strokeStyle="rgb(128, 128, 128)";this._context.stroke();this._context.restore();this._titleElement.classList.remove("hidden");this._titleElement.style.top=(boxY+3)+"px";this._titleElement.style.left=(boxX+3)+"px";},_viewportDimensions:function()
9810 {const gutterSize=30;const bordersSize=WebInspector.ScreencastView._bordersSize;return{width:this.element.offsetWidth-bordersSize-gutterSize,height:this.element.offsetHeight-bordersSize-gutterSize-WebInspector.ScreencastView._navBarHeight};},setInspectModeEnabled:function(enabled,inspectShadowDOM,config,callback)
9811 {this._inspectModeConfig=enabled?config:null;if(callback)
9812 callback(null);},_createCheckerboardPattern:function(context)
9813 {var pattern=(document.createElement("canvas"));const size=32;pattern.width=size*2;pattern.height=size*2;var pctx=pattern.getContext("2d");pctx.fillStyle="rgb(195, 195, 195)";pctx.fillRect(0,0,size*2,size*2);pctx.fillStyle="rgb(225, 225, 225)";pctx.fillRect(0,0,size,size);pctx.fillRect(size,size,size,size);return context.createPattern(pattern,"repeat");},_createNavigationBar:function()
9814 {this._navigationBar=this.element.createChild("div","toolbar-background screencast-navigation");this._navigationBack=this._navigationBar.createChild("button","back");this._navigationBack.disabled=true;this._navigationBack.addEventListener("click",this._navigateToHistoryEntry.bind(this,-1),false);this._navigationForward=this._navigationBar.createChild("button","forward");this._navigationForward.disabled=true;this._navigationForward.addEventListener("click",this._navigateToHistoryEntry.bind(this,1),false);this._navigationReload=this._navigationBar.createChild("button","reload");this._navigationReload.addEventListener("click",this._navigateReload.bind(this),false);this._navigationUrl=this._navigationBar.createChild("input");this._navigationUrl.type="text";this._navigationUrl.addEventListener('keyup',this._navigationUrlKeyUp.bind(this),true);this._navigationProgressBar=new WebInspector.ScreencastView.ProgressTracker(this._navigationBar.createChild("div","progress"));this._requestNavigationHistory();WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._requestNavigationHistory,this);},_navigateToHistoryEntry:function(offset)
9815 {var newIndex=this._historyIndex+offset;if(newIndex<0||newIndex>=this._historyEntries.length)
9816 return;PageAgent.navigateToHistoryEntry(this._historyEntries[newIndex].id);this._requestNavigationHistory();},_navigateReload:function()
9817 {WebInspector.resourceTreeModel.reloadPage();},_navigationUrlKeyUp:function(event)
9818 {if(event.keyIdentifier!='Enter')
9819 return;var url=this._navigationUrl.value;if(!url)
9820 return;if(!url.match(WebInspector.ScreencastView._HttpRegex))
9821 url="http://"+url;PageAgent.navigate(url);this._canvasElement.focus();},_requestNavigationHistory:function()
9822 {PageAgent.getNavigationHistory(this._onNavigationHistory.bind(this));},_onNavigationHistory:function(error,currentIndex,entries)
9823 {if(error)
9824 return;this._historyIndex=currentIndex;this._historyEntries=entries;this._navigationBack.disabled=currentIndex==0;this._navigationForward.disabled=currentIndex==(entries.length-1);var url=entries[currentIndex].url;var match=url.match(WebInspector.ScreencastView._HttpRegex);if(match)
9825 url=match[1];this._navigationUrl.value=url;},_focusNavigationBar:function()
9826 {this._navigationUrl.focus();this._navigationUrl.select();return true;},__proto__:WebInspector.View.prototype}
9827 WebInspector.ScreencastView.ProgressTracker=function(element){this._element=element;WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._onLoad,this);WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestStarted,this._onRequestStarted,this);WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished,this._onRequestFinished,this);};WebInspector.ScreencastView.ProgressTracker.prototype={_onMainFrameNavigated:function()
9828 {this._requestIds={};this._startedRequests=0;this._finishedRequests=0;this._maxDisplayedProgress=0;this._updateProgress(0.1);},_onLoad:function()
9829 {delete this._requestIds;this._updateProgress(1);setTimeout(function(){if(!this._navigationProgressVisible())
9830 this._displayProgress(0);}.bind(this),500);},_navigationProgressVisible:function()
9831 {return!!this._requestIds;},_onRequestStarted:function(event)
9832 {if(!this._navigationProgressVisible())
9833 return;var request=(event.data);if(request.type===WebInspector.resourceTypes.WebSocket)
9834 return;this._requestIds[request.requestId]=request;++this._startedRequests;},_onRequestFinished:function(event)
9835 {if(!this._navigationProgressVisible())
9836 return;var request=(event.data);if(!(request.requestId in this._requestIds))
9837 return;++this._finishedRequests;setTimeout(function(){this._updateProgress(this._finishedRequests/this._startedRequests*0.9);}.bind(this),500);},_updateProgress:function(progress)
9838 {if(!this._navigationProgressVisible())
9839 return;if(this._maxDisplayedProgress>=progress)
9840 return;this._maxDisplayedProgress=progress;this._displayProgress(progress);},_displayProgress:function(progress)
9841 {this._element.style.width=(100*progress)+"%";}};function platformExtensionAPI(coreAPI)
9842 {function getTabId()
9843 {return tabId;}
9844 chrome=window.chrome||{};var devtools_descriptor=Object.getOwnPropertyDescriptor(chrome,"devtools");if(!devtools_descriptor||devtools_descriptor.get)
9845 Object.defineProperty(chrome,"devtools",{value:{},enumerable:true});chrome.devtools.inspectedWindow={};chrome.devtools.inspectedWindow.__defineGetter__("tabId",getTabId);chrome.devtools.inspectedWindow.__proto__=coreAPI.inspectedWindow;chrome.devtools.network=coreAPI.network;chrome.devtools.panels=coreAPI.panels;if(extensionInfo.exposeExperimentalAPIs!==false){chrome.experimental=chrome.experimental||{};chrome.experimental.devtools=chrome.experimental.devtools||{};var properties=Object.getOwnPropertyNames(coreAPI);for(var i=0;i<properties.length;++i){var descriptor=Object.getOwnPropertyDescriptor(coreAPI,properties[i]);Object.defineProperty(chrome.experimental.devtools,properties[i],descriptor);}
9846 chrome.experimental.devtools.inspectedWindow=chrome.devtools.inspectedWindow;}
9847 if(extensionInfo.exposeWebInspectorNamespace)
9848 window.webInspector=coreAPI;}
9849 if(window.domAutomationController){var ___interactiveUiTestsMode=true;TestSuite=function()
9850 {this.controlTaken_=false;this.timerId_=-1;};TestSuite.prototype.fail=function(message)
9851 {if(this.controlTaken_)
9852 this.reportFailure_(message);else
9853 throw message;};TestSuite.prototype.assertEquals=function(expected,actual,opt_message)
9854 {if(expected!==actual){var message="Expected: '"+expected+"', but was '"+actual+"'";if(opt_message)
9855 message=opt_message+"("+message+")";this.fail(message);}};TestSuite.prototype.assertTrue=function(value,opt_message)
9856 {this.assertEquals(true,!!value,opt_message);};TestSuite.prototype.assertHasKey=function(object,key)
9857 {if(!object.hasOwnProperty(key))
9858 this.fail("Expected object to contain key '"+key+"'");};TestSuite.prototype.assertContains=function(string,substring)
9859 {if(string.indexOf(substring)===-1)
9860 this.fail("Expected to: '"+string+"' to contain '"+substring+"'");};TestSuite.prototype.takeControl=function()
9861 {this.controlTaken_=true;var self=this;this.timerId_=setTimeout(function(){self.reportFailure_("Timeout exceeded: 20 sec");},20000);};TestSuite.prototype.releaseControl=function()
9862 {if(this.timerId_!==-1){clearTimeout(this.timerId_);this.timerId_=-1;}
9863 this.reportOk_();};TestSuite.prototype.reportOk_=function()
9864 {window.domAutomationController.send("[OK]");};TestSuite.prototype.reportFailure_=function(error)
9865 {if(this.timerId_!==-1){clearTimeout(this.timerId_);this.timerId_=-1;}
9866 window.domAutomationController.send("[FAILED] "+error);};TestSuite.prototype.runTest=function(testName)
9867 {try{this[testName]();if(!this.controlTaken_)
9868 this.reportOk_();}catch(e){this.reportFailure_(e);}};TestSuite.prototype.showPanel=function(panelName)
9869 {var button=document.getElementById("tab-"+panelName);button.selectTabForTest();this.assertEquals(WebInspector.panels[panelName],WebInspector.inspectorView.currentPanel());};TestSuite.prototype.addSniffer=function(receiver,methodName,override,opt_sticky)
9870 {var orig=receiver[methodName];if(typeof orig!=="function")
9871 this.fail("Cannot find method to override: "+methodName);var test=this;receiver[methodName]=function(var_args){try{var result=orig.apply(this,arguments);}finally{if(!opt_sticky)
9872 receiver[methodName]=orig;}
9873 try{override.apply(this,arguments);}catch(e){test.fail("Exception in overriden method '"+methodName+"': "+e);}
9874 return result;};};TestSuite.prototype.testEnableResourcesTab=function()
9875 {}
9876 TestSuite.prototype.testCompletionOnPause=function()
9877 {}
9878 TestSuite.prototype.testShowScriptsTab=function()
9879 {this.showPanel("sources");var test=this;this._waitUntilScriptsAreParsed(["debugger_test_page.html"],function(){test.releaseControl();});this.takeControl();};TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh=function()
9880 {var test=this;this.assertEquals(WebInspector.panels.elements,WebInspector.inspectorView.currentPanel(),"Elements panel should be current one.");WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,waitUntilScriptIsParsed);test.evaluateInConsole_("window.location.reload(true);",function(resultText){});function waitUntilScriptIsParsed()
9881 {WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,waitUntilScriptIsParsed);test.showPanel("sources");test._waitUntilScriptsAreParsed(["debugger_test_page.html"],function(){test.releaseControl();});}
9882 this.takeControl();};TestSuite.prototype.testContentScriptIsPresent=function()
9883 {this.showPanel("sources");var test=this;test._waitUntilScriptsAreParsed(["page_with_content_script.html","simple_content_script.js"],function(){test.releaseControl();});this.takeControl();};TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch=function()
9884 {var test=this;var expectedScriptsCount=2;var parsedScripts=[];this.showPanel("sources");function switchToElementsTab(){test.showPanel("elements");setTimeout(switchToScriptsTab,0);}
9885 function switchToScriptsTab(){test.showPanel("sources");setTimeout(checkScriptsPanel,0);}
9886 function checkScriptsPanel(){test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]),"Some scripts are missing.");checkNoDuplicates();test.releaseControl();}
9887 function checkNoDuplicates(){var uiSourceCodes=test.nonAnonymousUISourceCodes_();for(var i=0;i<uiSourceCodes.length;i++){var scriptName=uiSourceCodes[i].url;for(var j=i+1;j<uiSourceCodes.length;j++)
9888 test.assertTrue(scriptName!==uiSourceCodes[j].url,"Found script duplicates: "+test.uiSourceCodesToString_(uiSourceCodes));}}
9889 test._waitUntilScriptsAreParsed(["debugger_test_page.html"],function(){checkNoDuplicates();setTimeout(switchToElementsTab,0);});this.takeControl();};TestSuite.prototype.testPauseWhenLoadingDevTools=function()
9890 {this.showPanel("sources");if(WebInspector.debuggerModel.debuggerPausedDetails)
9891 return;this._waitForScriptPause(this.releaseControl.bind(this));this.takeControl();};TestSuite.prototype.testPauseWhenScriptIsRunning=function()
9892 {this.showPanel("sources");this.evaluateInConsole_('setTimeout("handleClick()" , 0)',didEvaluateInConsole.bind(this));function didEvaluateInConsole(resultText){this.assertTrue(!isNaN(resultText),"Failed to get timer id: "+resultText);setTimeout(testScriptPause.bind(this),300);}
9893 function testScriptPause(){WebInspector.panels.sources._pauseButton.element.click();this._waitForScriptPause(this.releaseControl.bind(this));}
9894 this.takeControl();};TestSuite.prototype.testNetworkSize=function()
9895 {var test=this;function finishResource(resource,finishTime)
9896 {test.assertEquals(219,resource.transferSize,"Incorrect total encoded data length");test.assertEquals(25,resource.resourceSize,"Incorrect total data length");test.releaseControl();}
9897 this.addSniffer(WebInspector.NetworkDispatcher.prototype,"_finishNetworkRequest",finishResource);test.evaluateInConsole_("window.location.reload(true);",function(resultText){});this.takeControl();};TestSuite.prototype.testNetworkSyncSize=function()
9898 {var test=this;function finishResource(resource,finishTime)
9899 {test.assertEquals(219,resource.transferSize,"Incorrect total encoded data length");test.assertEquals(25,resource.resourceSize,"Incorrect total data length");test.releaseControl();}
9900 this.addSniffer(WebInspector.NetworkDispatcher.prototype,"_finishNetworkRequest",finishResource);test.evaluateInConsole_("var xhr = new XMLHttpRequest(); xhr.open(\"GET\", \"chunked\", false); xhr.send(null);",function(){});this.takeControl();};TestSuite.prototype.testNetworkRawHeadersText=function()
9901 {var test=this;function finishResource(resource,finishTime)
9902 {if(!resource.responseHeadersText)
9903 test.fail("Failure: resource does not have response headers text");test.assertEquals(164,resource.responseHeadersText.length,"Incorrect response headers text length");test.releaseControl();}
9904 this.addSniffer(WebInspector.NetworkDispatcher.prototype,"_finishNetworkRequest",finishResource);test.evaluateInConsole_("window.location.reload(true);",function(resultText){});this.takeControl();};TestSuite.prototype.testNetworkTiming=function()
9905 {var test=this;function finishResource(resource,finishTime)
9906 {test.assertTrue(resource.timing.receiveHeadersEnd-resource.timing.connectStart>=70,"Time between receiveHeadersEnd and connectStart should be >=70ms, but was "+"receiveHeadersEnd="+resource.timing.receiveHeadersEnd+", connectStart="+resource.timing.connectStart+".");test.assertTrue(resource.responseReceivedTime-resource.startTime>=0.07,"Time between responseReceivedTime and startTime should be >=0.07s, but was "+"responseReceivedTime="+resource.responseReceivedTime+", startTime="+resource.startTime+".");test.assertTrue(resource.endTime-resource.startTime>=0.14,"Time between endTime and startTime should be >=0.14s, but was "+"endtime="+resource.endTime+", startTime="+resource.startTime+".");test.releaseControl();}
9907 this.addSniffer(WebInspector.NetworkDispatcher.prototype,"_finishNetworkRequest",finishResource);test.evaluateInConsole_("window.location.reload(true);",function(resultText){});this.takeControl();};TestSuite.prototype.testConsoleOnNavigateBack=function()
9908 {if(WebInspector.console.messages.length===1)
9909 firstConsoleMessageReceived.call(this);else
9910 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,firstConsoleMessageReceived,this);function firstConsoleMessageReceived(){WebInspector.console.removeEventListener(WebInspector.ConsoleModel.Events.MessageAdded,firstConsoleMessageReceived,this);this.evaluateInConsole_("clickLink();",didClickLink.bind(this));}
9911 function didClickLink(){this.assertEquals(3,WebInspector.console.messages.length);this.assertEquals(1,WebInspector.console.messages[0].totalRepeatCount);this.evaluateInConsole_("history.back();",didNavigateBack.bind(this));}
9912 function didNavigateBack()
9913 {this.evaluateInConsole_("void 0;",didCompleteNavigation.bind(this));}
9914 function didCompleteNavigation(){this.assertEquals(7,WebInspector.console.messages.length);this.assertEquals(1,WebInspector.console.messages[0].totalRepeatCount);this.releaseControl();}
9915 this.takeControl();};TestSuite.prototype.testReattachAfterCrash=function()
9916 {this.evaluateInConsole_("1+1;",this.releaseControl.bind(this));this.takeControl();};TestSuite.prototype.testSharedWorker=function()
9917 {function didEvaluateInConsole(resultText){this.assertEquals("2011",resultText);this.releaseControl();}
9918 this.evaluateInConsole_("globalVar",didEvaluateInConsole.bind(this));this.takeControl();};TestSuite.prototype.testPauseInSharedWorkerInitialization=function()
9919 {if(WebInspector.debuggerModel.debuggerPausedDetails)
9920 return;this._waitForScriptPause(this.releaseControl.bind(this));this.takeControl();};TestSuite.prototype.testTimelineFrames=function()
9921 {var test=this;function step1()
9922 {test.recordTimeline(onTimelineRecorded);test.evaluateInConsole_("runTest()",function(){});}
9923 function onTimelineRecorded(records)
9924 {var frameCount=0;var recordsInFrame={};for(var i=0;i<records.length;++i){var record=records[i];if(record.type!=="BeginFrame"){recordsInFrame[record.type]=(recordsInFrame[record.type]||0)+1;continue;}
9925 if(!frameCount++)
9926 continue;test.assertHasKey(recordsInFrame,"FireAnimationFrame");test.assertHasKey(recordsInFrame,"Layout");test.assertHasKey(recordsInFrame,"RecalculateStyles");test.assertHasKey(recordsInFrame,"Paint");recordsInFrame={};}
9927 test.assertTrue(frameCount>=5,"Not enough frames");test.releaseControl();}
9928 step1();test.takeControl();}
9929 TestSuite.prototype.testPageOverlayUpdate=function()
9930 {var test=this;function populatePage()
9931 {var div1=document.createElement("div");div1.id="div1";div1.style.webkitTransform="translateZ(0)";document.body.appendChild(div1);var div2=document.createElement("div");div2.id="div2";document.body.appendChild(div2);}
9932 function step1()
9933 {test.evaluateInConsole_(populatePage.toString()+"; populatePage();"+"inspect(document.getElementById('div1'))",function(){});WebInspector.notifications.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,step2);}
9934 function step2()
9935 {WebInspector.notifications.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,step2);test.recordTimeline(onTimelineRecorded);setTimeout(step3,500);}
9936 function step3()
9937 {test.evaluateInConsole_("inspect(document.getElementById('div2'))",function(){});WebInspector.notifications.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,step4);}
9938 function step4()
9939 {WebInspector.notifications.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,step4);test.stopTimeline();}
9940 function onTimelineRecorded(records)
9941 {var types={};for(var i=0;i<records.length;++i)
9942 types[records[i].type]=(types[records[i].type]||0)+1;var frameCount=types["BeginFrame"];test.assertTrue(frameCount>=2,"Not enough DevTools overlay updates");test.assertTrue(frameCount<6,"Too many updates caused by DevTools overlay");test.releaseControl();}
9943 step1();this.takeControl();}
9944 TestSuite.prototype.recordTimeline=function(callback)
9945 {var records=[];var dispatchOnRecordType={}
9946 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,addRecord);WebInspector.timelineManager.start();function addRecord(event)
9947 {innerAddRecord(event.data);}
9948 function innerAddRecord(record)
9949 {records.push(record);if(record.type==="TimeStamp"&&record.data.message==="ready")
9950 done();if(record.children)
9951 record.children.forEach(innerAddRecord);}
9952 function done()
9953 {WebInspector.timelineManager.stop();WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,addRecord);callback(records);}}
9954 TestSuite.prototype.stopTimeline=function()
9955 {this.evaluateInConsole_("console.timeStamp('ready')",function(){});}
9956 TestSuite.prototype.waitForTestResultsInConsole=function()
9957 {var messages=WebInspector.console.messages;for(var i=0;i<messages.length;++i){var text=messages[i].text;if(text==="PASS")
9958 return;else if(/^FAIL/.test(text))
9959 this.fail(text);}
9960 function onConsoleMessage(event)
9961 {var text=event.data.text;if(text==="PASS")
9962 this.releaseControl();else if(/^FAIL/.test(text))
9963 this.fail(text);}
9964 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,onConsoleMessage,this);this.takeControl();};TestSuite.prototype.checkLogAndErrorMessages=function()
9965 {var messages=WebInspector.console.messages;var matchesCount=0;function validMessage(message)
9966 {if(message.text==="log"&&message.level===WebInspector.ConsoleMessage.MessageLevel.Log){++matchesCount;return true;}
9967 if(message.text==="error"&&message.level===WebInspector.ConsoleMessage.MessageLevel.Error){++matchesCount;return true;}
9968 return false;}
9969 for(var i=0;i<messages.length;++i){if(validMessage(messages[i]))
9970 continue;this.fail(messages[i].text+":"+messages[i].level);}
9971 if(matchesCount===2)
9972 return;function onConsoleMessage(event)
9973 {var message=event.data;if(validMessage(message)){if(matchesCount===2){this.releaseControl();return;}}else
9974 this.fail(message.text+":"+messages[i].level);}
9975 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,onConsoleMessage,this);this.takeControl();};TestSuite.prototype.uiSourceCodesToString_=function(uiSourceCodes)
9976 {var names=[];for(var i=0;i<uiSourceCodes.length;i++)
9977 names.push('"'+uiSourceCodes[i].url+'"');return names.join(",");};TestSuite.prototype.nonAnonymousUISourceCodes_=function()
9978 {function filterOutAnonymous(uiSourceCode)
9979 {return!!uiSourceCode.url;}
9980 function filterOutService(uiSourceCode)
9981 {return!uiSourceCode.project().isServiceProject();}
9982 var uiSourceCodes=WebInspector.workspace.uiSourceCodes();uiSourceCodes=uiSourceCodes.filter(filterOutService);return uiSourceCodes.filter(filterOutAnonymous);};TestSuite.prototype.evaluateInConsole_=function(code,callback)
9983 {WebInspector.showConsole();WebInspector.consoleView.prompt.text=code;WebInspector.consoleView.promptElement.dispatchEvent(TestSuite.createKeyEvent("Enter"));this.addSniffer(WebInspector.ConsoleView.prototype,"_showConsoleMessage",function(messageIndex){var commandResult=WebInspector.console.messages[messageIndex];callback(commandResult.toMessageElement().textContent);});};TestSuite.prototype._scriptsAreParsed=function(expected)
9984 {var uiSourceCodes=this.nonAnonymousUISourceCodes_();var missing=expected.slice(0);for(var i=0;i<uiSourceCodes.length;++i){for(var j=0;j<missing.length;++j){if(uiSourceCodes[i].name().search(missing[j])!==-1){missing.splice(j,1);break;}}}
9985 return missing.length===0;};TestSuite.prototype._waitForScriptPause=function(callback)
9986 {function pauseListener(event){WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,pauseListener,this);callback();}
9987 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,pauseListener,this);};TestSuite.prototype._executeCodeWhenScriptsAreParsed=function(code,expectedScripts)
9988 {var test=this;function executeFunctionInInspectedPage(){test.evaluateInConsole_('setTimeout("'+code+'" , 0)',function(resultText){test.assertTrue(!isNaN(resultText),"Failed to get timer id: "+resultText+". Code: "+code);});}
9989 test._waitUntilScriptsAreParsed(expectedScripts,executeFunctionInInspectedPage);};TestSuite.prototype._waitUntilScriptsAreParsed=function(expectedScripts,callback)
9990 {var test=this;function waitForAllScripts(){if(test._scriptsAreParsed(expectedScripts))
9991 callback();else
9992 test.addSniffer(WebInspector.panels.sources,"_addUISourceCode",waitForAllScripts);}
9993 waitForAllScripts();};TestSuite.createKeyEvent=function(keyIdentifier)
9994 {var evt=document.createEvent("KeyboardEvent");evt.initKeyboardEvent("keydown",true,true,null,keyIdentifier,"");return evt;};var uiTests={};uiTests.runAllTests=function()
9995 {for(var name in TestSuite.prototype){if(name.substring(0,4)==="test"&&typeof TestSuite.prototype[name]==="function")
9996 uiTests.runTest(name);}};uiTests.runTest=function(name)
9997 {if(uiTests._populatedInterface)
9998 new TestSuite().runTest(name);else
9999 uiTests._pendingTestName=name;};(function(){function runTests()
10000 {uiTests._populatedInterface=true;var name=uiTests._pendingTestName;delete uiTests._pendingTestName;if(name)
10001 new TestSuite().runTest(name);}
10002 var oldLoadCompleted=InspectorFrontendAPI.loadCompleted;InspectorFrontendAPI.loadCompleted=function()
10003 {oldLoadCompleted.call(InspectorFrontendAPI);runTests();}})();}
10004 WebInspector.FlameChart=function(dataProvider)
10005 {WebInspector.View.call(this);this.registerRequiredCSS("flameChart.css");this.element.className="fill";this.element.id="cpu-flame-chart";this._overviewPane=new WebInspector.FlameChart.OverviewPane(dataProvider);this._overviewPane.show(this.element);this._mainPane=new WebInspector.FlameChart.MainPane(dataProvider,this._overviewPane);this._mainPane.show(this.element);this._mainPane.addEventListener(WebInspector.FlameChart.Events.EntrySelected,this._onEntrySelected,this);this._overviewPane._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,this._onWindowChanged,this);if(!WebInspector.FlameChart._colorGenerator)
10006 WebInspector.FlameChart._colorGenerator=new WebInspector.FlameChart.ColorGenerator();}
10007 WebInspector.FlameChart.prototype={_onWindowChanged:function(event)
10008 {this._mainPane.changeWindow(this._overviewPane._overviewGrid.windowLeft(),this._overviewPane._overviewGrid.windowRight());},selectRange:function(timeLeft,timeRight)
10009 {this._overviewPane._selectRange(timeLeft,timeRight);},_onEntrySelected:function(event)
10010 {this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelected,event.data);},update:function()
10011 {this._overviewPane.update();this._mainPane.update();},__proto__:WebInspector.View.prototype};WebInspector.FlameChartDataProvider=function()
10012 {}
10013 WebInspector.FlameChartDataProvider.prototype={timelineData:function(colorGenerator){},prepareHighlightedEntryInfo:function(entryIndex){},canJumpToEntry:function(entryIndex){},entryData:function(entryIndex){}}
10014 WebInspector.FlameChart.Calculator=function()
10015 {}
10016 WebInspector.FlameChart.Calculator.prototype={_updateBoundaries:function(mainPane)
10017 {function log10(x)
10018 {return Math.log(x)/Math.LN10;}
10019 this._decimalDigits=Math.max(0,-Math.floor(log10(mainPane._timelineGrid.gridSliceTime*1.01)));var totalTime=mainPane._timelineData().totalTime;this._minimumBoundaries=mainPane._windowLeft*totalTime;this._maximumBoundaries=mainPane._windowRight*totalTime;this.paddingLeft=mainPane._paddingLeft;this._width=mainPane._canvas.width-this.paddingLeft;this._timeToPixel=this._width/this.boundarySpan();},computePosition:function(time)
10020 {return(time-this._minimumBoundaries)*this._timeToPixel+this.paddingLeft;},formatTime:function(value,hires)
10021 {var format="%."+this._decimalDigits+"f\u2009ms";return WebInspector.UIString(format,value+this._minimumBoundaries);},maximumBoundary:function()
10022 {return this._maximumBoundaries;},minimumBoundary:function()
10023 {return this._minimumBoundaries;},zeroTime:function()
10024 {return 0;},boundarySpan:function()
10025 {return this._maximumBoundaries-this._minimumBoundaries;}}
10026 WebInspector.FlameChart.OverviewCalculator=function()
10027 {}
10028 WebInspector.FlameChart.OverviewCalculator.prototype={_updateBoundaries:function(overviewPane)
10029 {this._minimumBoundaries=0;var totalTime=overviewPane._timelineData().totalTime;this._maximumBoundaries=totalTime;this._xScaleFactor=overviewPane._overviewCanvas.width/totalTime;},computePosition:function(time)
10030 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(value,hires)
10031 {return Number.secondsToString((value+this._minimumBoundaries)/1000,hires);},maximumBoundary:function()
10032 {return this._maximumBoundaries;},minimumBoundary:function()
10033 {return this._minimumBoundaries;},zeroTime:function()
10034 {return this._minimumBoundaries;},boundarySpan:function()
10035 {return this._maximumBoundaries-this._minimumBoundaries;}}
10036 WebInspector.FlameChart.Events={EntrySelected:"EntrySelected"}
10037 WebInspector.FlameChart.ColorGenerator=function()
10038 {this._colorPairs={};this._colorIndexes=[];this._currentColorIndex=0;this._colorPairForID("(idle)::0",50);this._colorPairForID("(program)::0",50);this._colorPairForID("(garbage collector)::0",50);}
10039 WebInspector.FlameChart.ColorGenerator.prototype={_colorPairForID:function(id,sat)
10040 {if(typeof sat!=="number")
10041 sat=100;var colorPairs=this._colorPairs;var colorPair=colorPairs[id];if(!colorPair){colorPairs[id]=colorPair=this._createPair(this._currentColorIndex++,sat);this._colorIndexes[colorPair.index]=colorPair;}
10042 return colorPair;},_colorPairForIndex:function(index)
10043 {return this._colorIndexes[index];},_createPair:function(index,sat)
10044 {var hue=(index*7+12*(index%2))%360;return{index:index,highlighted:"hsla("+hue+", "+sat+"%, 33%, 0.7)",normal:"hsla("+hue+", "+sat+"%, 66%, 0.7)"}}}
10045 WebInspector.FlameChart.OverviewPaneInterface=function()
10046 {}
10047 WebInspector.FlameChart.OverviewPaneInterface.prototype={zoom:function(zoom,referencePoint){},setWindow:function(windowLeft,windowRight){},}
10048 WebInspector.FlameChart.OverviewPane=function(dataProvider)
10049 {WebInspector.View.call(this);this._overviewContainer=this.element.createChild("div","overview-container");this._overviewGrid=new WebInspector.OverviewGrid("flame-chart");this._overviewGrid.element.classList.add("fill");this._overviewCanvas=this._overviewContainer.createChild("canvas","flame-chart-overview-canvas");this._overviewContainer.appendChild(this._overviewGrid.element);this._overviewCalculator=new WebInspector.FlameChart.OverviewCalculator();this._dataProvider=dataProvider;}
10050 WebInspector.FlameChart.OverviewPane.prototype={zoom:function(zoom,referencePoint)
10051 {this._overviewGrid.zoom(zoom,referencePoint);},setWindow:function(windowLeft,windowRight)
10052 {this._overviewGrid.setWindow(windowLeft,windowRight);},_selectRange:function(timeLeft,timeRight)
10053 {var timelineData=this._timelineData();if(!timelineData)
10054 return;this._overviewGrid.setWindow(timeLeft/timelineData._totalTime,timeRight/timelineData._totalTime);},_timelineData:function()
10055 {return this._dataProvider.timelineData(WebInspector.FlameChart._colorGenerator);},onResize:function()
10056 {this._scheduleUpdate();},_scheduleUpdate:function()
10057 {if(this._updateTimerId)
10058 return;this._updateTimerId=setTimeout(this.update.bind(this),10);},update:function()
10059 {this._updateTimerId=0;var timelineData=this._timelineData();if(!timelineData)
10060 return;this._resetCanvas(this._overviewContainer.clientWidth,this._overviewContainer.clientHeight-20);this._overviewCalculator._updateBoundaries(this);this._overviewGrid.updateDividers(this._overviewCalculator);WebInspector.FlameChart.OverviewPane.drawOverviewCanvas(timelineData,this._overviewCanvas.getContext("2d"),this._overviewContainer.clientWidth,this._overviewContainer.clientHeight-20);},_resetCanvas:function(width,height)
10061 {var ratio=window.devicePixelRatio;this._overviewCanvas.width=width*ratio;this._overviewCanvas.height=height*ratio;},__proto__:WebInspector.View.prototype}
10062 WebInspector.FlameChart.OverviewPane.calculateDrawData=function(timelineData,width)
10063 {var entryOffsets=timelineData.entryOffsets;var entryTotalTimes=timelineData.entryTotalTimes;var entryLevels=timelineData.entryLevels;var length=entryOffsets.length;var drawData=new Uint8Array(width);var scaleFactor=width/timelineData.totalTime;for(var entryIndex=0;entryIndex<length;++entryIndex){var start=Math.floor(entryOffsets[entryIndex]*scaleFactor);var finish=Math.floor((entryOffsets[entryIndex]+entryTotalTimes[entryIndex])*scaleFactor);for(var x=start;x<=finish;++x)
10064 drawData[x]=Math.max(drawData[x],entryLevels[entryIndex]+1);}
10065 return drawData;}
10066 WebInspector.FlameChart.OverviewPane.drawOverviewCanvas=function(timelineData,context,width,height)
10067 {var drawData=WebInspector.FlameChart.OverviewPane.calculateDrawData(timelineData,width);if(!drawData)
10068 return;var ratio=window.devicePixelRatio;var canvasWidth=width*ratio;var canvasHeight=height*ratio;var yScaleFactor=canvasHeight/(timelineData.maxStackDepth*1.1);context.lineWidth=1;context.translate(0.5,0.5);context.strokeStyle="rgba(20,0,0,0.4)";context.fillStyle="rgba(214,225,254,0.8)";context.moveTo(-1,canvasHeight-1);if(drawData)
10069 context.lineTo(-1,Math.round(height-drawData[0]*yScaleFactor-1));var value;for(var x=0;x<width;++x){value=Math.round(canvasHeight-drawData[x]*yScaleFactor-1);context.lineTo(x*ratio,value);}
10070 context.lineTo(canvasWidth+1,value);context.lineTo(canvasWidth+1,canvasHeight-1);context.fill();context.stroke();context.closePath();}
10071 WebInspector.FlameChart.MainPane=function(dataProvider,overviewPane)
10072 {WebInspector.View.call(this);this._overviewPane=overviewPane;this._chartContainer=this.element.createChild("div","chart-container");this._timelineGrid=new WebInspector.TimelineGrid();this._chartContainer.appendChild(this._timelineGrid.element);this._calculator=new WebInspector.FlameChart.Calculator();this._canvas=this._chartContainer.createChild("canvas");this._canvas.addEventListener("mousemove",this._onMouseMove.bind(this));this._canvas.addEventListener("mousewheel",this._onMouseWheel.bind(this),false);this._canvas.addEventListener("click",this._onClick.bind(this),false);WebInspector.installDragHandle(this._canvas,this._startCanvasDragging.bind(this),this._canvasDragging.bind(this),this._endCanvasDragging.bind(this),"col-resize");this._entryInfo=this._chartContainer.createChild("div","entry-info");this._dataProvider=dataProvider;this._windowLeft=0.0;this._windowRight=1.0;this._windowWidth=1.0;this._barHeight=15;this._minWidth=1;this._paddingLeft=15;this._highlightedEntryIndex=-1;}
10073 WebInspector.FlameChart.MainPane.prototype={_timelineData:function()
10074 {return this._dataProvider.timelineData(WebInspector.FlameChart._colorGenerator);},changeWindow:function(windowLeft,windowRight)
10075 {this._windowLeft=windowLeft;this._windowRight=windowRight;this._windowWidth=this._windowRight-this._windowLeft;this._scheduleUpdate();},_startCanvasDragging:function(event)
10076 {if(!this._timelineData())
10077 return false;this._isDragging=true;this._wasDragged=false;this._dragStartPoint=event.pageX;this._dragStartWindowLeft=this._windowLeft;this._dragStartWindowRight=this._windowRight;return true;},_canvasDragging:function(event)
10078 {var pixelShift=this._dragStartPoint-event.pageX;var windowShift=pixelShift/this._totalPixels;var windowLeft=Math.max(0,this._dragStartWindowLeft+windowShift);if(windowLeft===this._windowLeft)
10079 return;windowShift=windowLeft-this._dragStartWindowLeft;var windowRight=Math.min(1,this._dragStartWindowRight+windowShift);if(windowRight===this._windowRight)
10080 return;windowShift=windowRight-this._dragStartWindowRight;this._overviewPane.setWindow(this._dragStartWindowLeft+windowShift,this._dragStartWindowRight+windowShift);this._wasDragged=true;},_endCanvasDragging:function()
10081 {this._isDragging=false;},_onMouseMove:function(event)
10082 {if(this._isDragging)
10083 return;var entryIndex=this._coordinatesToEntryIndex(event.offsetX,event.offsetY);if(this._highlightedEntryIndex===entryIndex)
10084 return;if(entryIndex===-1||!this._dataProvider.canJumpToEntry(entryIndex))
10085 this._canvas.style.cursor="default";else
10086 this._canvas.style.cursor="pointer";this._highlightedEntryIndex=entryIndex;this._scheduleUpdate();},_onClick:function()
10087 {if(this._wasDragged)
10088 return;if(this._highlightedEntryIndex===-1)
10089 return;var data=this._dataProvider.entryData(this._highlightedEntryIndex);this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelected,data);},_onMouseWheel:function(e)
10090 {if(e.wheelDeltaY){const zoomFactor=1.1;const mouseWheelZoomSpeed=1/120;var zoom=Math.pow(zoomFactor,-e.wheelDeltaY*mouseWheelZoomSpeed);var referencePoint=(this._pixelWindowLeft+e.offsetX-this._paddingLeft)/this._totalPixels;this._overviewPane.zoom(zoom,referencePoint);}else{var shift=Number.constrain(-1*this._windowWidth/4*e.wheelDeltaX/120,-this._windowLeft,1-this._windowRight);this._overviewPane.setWindow(this._windowLeft+shift,this._windowRight+shift);}},_coordinatesToEntryIndex:function(x,y)
10091 {var timelineData=this._timelineData();if(!timelineData)
10092 return-1;var cursorTime=(x+this._pixelWindowLeft-this._paddingLeft)*this._pixelToTime;var cursorLevel=Math.floor((this._canvas.height/window.devicePixelRatio-y)/this._barHeight);var entryOffsets=timelineData.entryOffsets;var entryTotalTimes=timelineData.entryTotalTimes;var entryLevels=timelineData.entryLevels;var length=entryOffsets.length;for(var i=0;i<length;++i){if(cursorTime<entryOffsets[i])
10093 return-1;if(cursorTime<(entryOffsets[i]+entryTotalTimes[i])&&cursorLevel===entryLevels[i])
10094 return i;}
10095 return-1;},draw:function(width,height)
10096 {var timelineData=this._timelineData();if(!timelineData)
10097 return;var ratio=window.devicePixelRatio;this._canvas.width=width*ratio;this._canvas.height=height*ratio;this._canvas.style.width=width+"px";this._canvas.style.height=height+"px";var context=this._canvas.getContext("2d");context.scale(ratio,ratio);var timeWindowRight=this._timeWindowRight;var timeToPixel=this._timeToPixel;var pixelWindowLeft=this._pixelWindowLeft;var paddingLeft=this._paddingLeft;var minWidth=this._minWidth;var entryTotalTimes=timelineData.entryTotalTimes;var entryOffsets=timelineData.entryOffsets;var entryLevels=timelineData.entryLevels;var colorEntryIndexes=timelineData.colorEntryIndexes;var entryTitles=timelineData.entryTitles;var entryDeoptFlags=timelineData.entryDeoptFlags;var colorGenerator=WebInspector.FlameChart._colorGenerator;var titleIndexes=new Uint32Array(timelineData.entryTotalTimes);var lastTitleIndex=0;var dotsWidth=context.measureText("\u2026").width;var textPaddingLeft=2;this._minTextWidth=context.measureText("\u2026").width+textPaddingLeft;var minTextWidth=this._minTextWidth;var marksField=[];for(var i=0;i<timelineData.maxStackDepth;++i)
10098 marksField.push(new Uint16Array(width));var barHeight=this._barHeight;var barX=0;var barWidth=0;var barRight=0;var barLevel=0;var bHeight=height-barHeight;context.strokeStyle="black";var colorPair;var entryIndex=0;var entryOffset=0;for(var colorIndex=0;colorIndex<colorEntryIndexes.length;++colorIndex){colorPair=colorGenerator._colorPairForIndex(colorIndex);context.fillStyle=colorPair.normal;var indexes=colorEntryIndexes[colorIndex];if(!indexes)
10099 continue;context.beginPath();for(var i=0;i<indexes.length;++i){entryIndex=indexes[i];entryOffset=entryOffsets[entryIndex];if(entryOffset>timeWindowRight)
10100 break;barX=Math.ceil(entryOffset*timeToPixel)-pixelWindowLeft+paddingLeft;if(barX>=width)
10101 continue;barRight=Math.floor((entryOffset+entryTotalTimes[entryIndex])*timeToPixel)-pixelWindowLeft+paddingLeft;if(barRight<0)
10102 continue;barWidth=(barRight-barX)||minWidth;barLevel=entryLevels[entryIndex];var marksRow=marksField[barLevel];if(barWidth<=marksRow[barX])
10103 continue;marksRow[barX]=barWidth;if(entryIndex===this._highlightedEntryIndex){context.fill();context.beginPath();context.fillStyle=colorPair.highlighted;}
10104 context.rect(barX,bHeight-barLevel*barHeight,barWidth,barHeight);if(entryIndex===this._highlightedEntryIndex){context.fill();context.beginPath();context.fillStyle=colorPair.normal;}
10105 if(barWidth>minTextWidth)
10106 titleIndexes[lastTitleIndex++]=entryIndex;}
10107 context.fill();}
10108 var font=(barHeight-4)+"px "+window.getComputedStyle(this.element,null).getPropertyValue("font-family");var boldFont="bold "+font;var isBoldFontSelected=false;context.font=font;context.textBaseline="alphabetic";context.fillStyle="#333";this._dotsWidth=context.measureText("\u2026").width;var textBaseHeight=bHeight+barHeight-4;for(var i=0;i<lastTitleIndex;++i){entryIndex=titleIndexes[i];if(isBoldFontSelected){if(!entryDeoptFlags[entryIndex]){context.font=font;isBoldFontSelected=false;}}else{if(entryDeoptFlags[entryIndex]){context.font=boldFont;isBoldFontSelected=true;}}
10109 entryOffset=entryOffsets[entryIndex];barX=Math.floor(entryOffset*timeToPixel)-pixelWindowLeft+paddingLeft;barRight=Math.ceil((entryOffset+entryTotalTimes[entryIndex])*timeToPixel)-pixelWindowLeft+paddingLeft;barWidth=(barRight-barX)||minWidth;var xText=Math.max(0,barX);var widthText=barWidth-textPaddingLeft+barX-xText;var title=this._prepareText(context,entryTitles[entryIndex],widthText);if(title)
10110 context.fillText(title,xText+textPaddingLeft,textBaseHeight-entryLevels[entryIndex]*barHeight);}
10111 this._entryInfo.removeChildren();if(!this._isDragging){var entryInfo=this._dataProvider.prepareHighlightedEntryInfo(this._highlightedEntryIndex);if(entryInfo)
10112 this._entryInfo.appendChild(this._buildEntryInfo(entryInfo));}},_buildEntryInfo:function(entryInfo)
10113 {var infoTable=document.createElement("table");infoTable.className="info-table";for(var i=0;i<entryInfo.length;++i){var row=infoTable.createChild("tr");var titleCell=row.createChild("td");titleCell.textContent=entryInfo[i].title;titleCell.className="title";var textCell=row.createChild("td");textCell.textContent=entryInfo[i].text;}
10114 return infoTable;},_prepareText:function(context,title,maxSize)
10115 {if(maxSize<this._dotsWidth)
10116 return null;var titleWidth=context.measureText(title).width;if(maxSize>titleWidth)
10117 return title;maxSize-=this._dotsWidth;var dotRegExp=/[\.\$]/g;var match=dotRegExp.exec(title);if(!match){var visiblePartSize=maxSize/titleWidth;var newTextLength=Math.floor(title.length*visiblePartSize)+1;var minTextLength=4;if(newTextLength<minTextLength)
10118 return null;var substring;do{--newTextLength;substring=title.substring(0,newTextLength);}while(context.measureText(substring).width>maxSize);return title.substring(0,newTextLength)+"\u2026";}
10119 while(match){var substring=title.substring(match.index+1);var width=context.measureText(substring).width;if(maxSize>width)
10120 return"\u2026"+substring;match=dotRegExp.exec(title);}
10121 var i=0;do{++i;}while(context.measureText(title.substring(0,i)).width<maxSize);return title.substring(0,i-1)+"\u2026";},_updateBoundaries:function()
10122 {this._totalTime=this._timelineData().totalTime;this._timeWindowLeft=this._windowLeft*this._totalTime;this._timeWindowRight=this._windowRight*this._totalTime;this._pixelWindowWidth=this._chartContainer.clientWidth-this._paddingLeft;this._totalPixels=Math.floor(this._pixelWindowWidth/this._windowWidth);this._pixelWindowLeft=Math.floor(this._totalPixels*this._windowLeft);this._pixelWindowRight=Math.floor(this._totalPixels*this._windowRight);this._timeToPixel=this._totalPixels/this._totalTime;this._pixelToTime=this._totalTime/this._totalPixels;this._paddingLeftTime=this._paddingLeft/this._timeToPixel;},onResize:function()
10123 {this._scheduleUpdate();},_scheduleUpdate:function()
10124 {if(this._updateTimerId)
10125 return;this._updateTimerId=setTimeout(this.update.bind(this),10);},update:function()
10126 {this._updateTimerId=0;if(!this._timelineData())
10127 return;this._updateBoundaries();this.draw(this._chartContainer.clientWidth,this._chartContainer.clientHeight);this._calculator._updateBoundaries(this);this._timelineGrid.element.style.width=this.element.clientWidth;this._timelineGrid.updateDividers(this._calculator);},__proto__:WebInspector.View.prototype}
10128 WebInspector.PaintProfilerSnapshot=function(snapshotId)
10129 {this._id=snapshotId;}
10130 WebInspector.PaintProfilerSnapshot.prototype={dispose:function()
10131 {LayerTreeAgent.releaseSnapshot(this._id);},requestImage:function(firstStep,lastStep,callback)
10132 {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.replaySnapshot(): ");LayerTreeAgent.replaySnapshot(this._id,firstStep||undefined,lastStep||undefined,wrappedCallback);},profile:function(callback)
10133 {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.profileSnapshot(): ");LayerTreeAgent.profileSnapshot(this._id,5,1,wrappedCallback);}};