var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),Customization;(function(n){var t=function(){function n(n,t,i){this.name=n;this.selector=t;this.variableGroups=i}return n.prototype.associations=function(){return[]},n}(),u,f,e,o,i,s,h,c,l,a,v,y,p,w,b,k,r,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht;n.Element=t;u=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Text",t.selector="a, p, ol, ul, dl, dt, dd, cite",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-family-base","font-size-base","line-height-base","line-height-computed","text-color","text-muted","page-header-border-color","abbr-border-color","link-color","link-hover-color"])},t}(t);n.Text=u;f=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Label",t.selector="label",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["label-default-bg","label-primary-bg","label-success-bg","label-info-bg","label-warning-bg","label-danger-bg","label-color","label-link-hover-color"])},t}(t);n.Label=f;e=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Blockquote",t.selector="blockquote",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["text-muted","line-height-computed","line-height-base","abbr-border-color","blockquote-font-size","blockquote-border-color","blockquote-small-color"])},t}(t);n.Blockquote=e;o=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Navigation bar",t.selector=".navbar",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["border-radius-base","font-size-large","line-height-computed","navbar-border-radius","navbar-collapse-max-height","navbar-default-bg","navbar-default-border","navbar-default-brand-color","navbar-default-brand-hover-bg","navbar-default-brand-hover-color","navbar-default-color","navbar-default-link-active-bg","navbar-default-link-active-color","navbar-default-link-color","navbar-default-link-disabled-bg","navbar-default-link-disabled-color","navbar-default-link-hover-bg","navbar-default-link-hover-color","navbar-default-toggle-border-color","navbar-default-toggle-hover-bg","navbar-default-toggle-icon-bar-bg","navbar-height","navbar-inverse-bg","navbar-inverse-border","navbar-inverse-brand-color","navbar-inverse-brand-hover-bg","navbar-inverse-brand-hover-color","navbar-inverse-color","navbar-inverse-link-active-bg","navbar-inverse-link-active-color","navbar-inverse-link-color","navbar-inverse-link-disabled-bg","navbar-inverse-link-disabled-color","navbar-inverse-link-hover-bg","navbar-inverse-link-hover-color","navbar-inverse-toggle-border-color","navbar-inverse-toggle-hover-bg","navbar-inverse-toggle-icon-bar-bg","navbar-margin-bottom","navbar-padding-horizontal","navbar-padding-vertical","zindex-navbar","zindex-navbar-fixed"])},t}(t);n.Navbar=o;i=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["headings-font-family","headings-font-weight","headings-line-height","headings-color","headings-small-color","line-height-computed","text-muted","line-height-base"])},t}(t);n.Heading=i;s=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Heading 1",t.selector="h1",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-size-h1"])},t}(i);n.Heading1=s;h=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Heading 2",t.selector="h2",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-size-h2"])},t}(i);n.Heading2=h;c=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Heading 3",t.selector="h3",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-size-h3"])},t}(i);n.Heading3=c;l=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Heading 4",t.selector="h4",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-size-h4"])},t}(i);n.Heading4=l;a=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Heading 5",t.selector="h5",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-size-h5"])},t}(i);n.Heading5=a;v=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Heading 6",t.selector="h6",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-size-h6"])},t}(i);n.Heading6=v;y=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Table",t.selector=".table",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["table-bg","line-height-computed","table-cell-padding","line-height-base","table-border-color","table-border-color","table-border-color","body-bg","table-condensed-cell-padding","table-border-color","table-border-color","table-bg-accent","table-bg-hover","table-border-color"])},t}(t);n.Table=y;p=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Form",t.selector=".form-group, .form-control",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["input-color-placeholder","line-height-computed","legend-color","legend-border-color","font-size-base","padding-base-horizontal","line-height-base","input-color","input-bg","input-border","input-border-radius","input-border-focus","input-bg-disabled","input-height-small","padding-small-vertical","padding-small-horizontal","font-size-small","line-height-small","input-height-large","padding-large-vertical","padding-large-horizontal","font-size-large","line-height-large","input-height-base","state-success-text","state-success-text","state-warning-text","state-warning-text","state-danger-text","state-danger-text"])},t}(t);n.Form=p;w=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Form legend",t.selector="legend",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["legend-color","legend-border-color","font-size-base","line-height-computed"])},t}(t);n.FormLegend=w;b=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Panel",t.selector=".panel",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["panel-bg","line-height-computed","panel-body-padding","panel-border-radius","panel-danger-border","panel-danger-heading-bg","panel-danger-text","panel-default-border","panel-default-heading-bg","panel-default-text","panel-footer-bg","panel-info-border","panel-info-heading-bg","panel-info-text","panel-inner-border","panel-primary-border","panel-primary-heading-bg","panel-primary-text","panel-success-border","panel-success-heading-bg","panel-success-text","panel-warning-border","panel-warning-heading-bg","panel-warning-text","table-border-color"])},t}(t);n.Panel=b;k=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Button group",t.selector=".btn-group",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["caret-width-large","border-radius-base"])},t}(i);n.ButtonGroup=k;r=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["btn-font-weight","btn-default-color","btn-default-bg","btn-primary-color","btn-primary-bg","btn-success-color","btn-success-bg","btn-info-color","btn-info-bg","btn-warning-color","btn-warning-bg","btn-danger-color","btn-danger-bg"])},t}(t);n.Button=r;d=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Regular button",t.selector=".btn",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-size-base","line-height-base","padding-base-vertical","padding-base-horizontal"])},t}(r);n.RegularButton=d;g=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Large button",t.selector=".btn-lg",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["padding-large-vertical","padding-large-horizontal","font-size-large","line-height-large","border-radius-large"])},t}(r);n.LargeButton=g;nt=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Small button",t.selector=".btn-sm",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["padding-small-vertical","padding-small-horizontal","font-size-small","line-height-small","border-radius-small"])},t}(r);n.SmallButton=nt;tt=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Extra small button",t.selector=".btn-xs",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["padding-xs-vertical","padding-xs-horizontal","font-size-small","line-height-small","border-radius-small"])},t}(r);n.ExtraSmallButton=tt;it=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Link button",t.selector=".btn-link",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["link-color","link-hover-color","btn-link-disabled-color"])},t}(r);n.LinkButton=it;rt=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Code block",t.selector="pre, code",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["font-family-monospace","code-color","code-bg","border-radius-base","kbd-color","kbd-bg","border-radius-small","line-height-base","pre-color","pre-bg","pre-border-color","border-radius-base","pre-scrollable-max-height"])},t}(r);n.CodeBlock=rt;ut=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Header",t.selector=".zone-header",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["zone-header-bg","zone-header-color","zone-header-padding-horizontal","zone-header-padding-vertical","zone-header-border","zone-header-border-radius"])},t}(t);n.HeaderZone=ut;ft=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Content",t.selector=".zone-content",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["zone-content-bg","zone-content-color","zone-content-padding-horizontal","zone-content-padding-vertical","zone-content-border","zone-content-border-radius"])},t}(t);n.ContentZone=ft;et=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Aside",t.selector=".zone-aside-first",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["zone-aside-first-bg","zone-aside-first-color","zone-aside-first-padding-horizontal","zone-aside-first-padding-vertical","zone-aside-first-border","zone-aside-first-border-radius"])},t}(t);n.AsideFirstZone=et;ot=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Footer",t.selector=".zone-footer",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["zone-footer-bg","zone-footer-color","zone-footer-padding-horizontal","zone-footer-padding-vertical","zone-footer-border","zone-footer-border-radius"])},t}(t);n.FooterZone=ot;st=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Pills",t.selector=".nav.nav-pills",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["nav-pills-border-radius","nav-pills-active-link-hover-bg","nav-pills-active-link-hover-color"])},t}(t);n.Pills=st;ht=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.name="Pagination",t.selector=".pagination",t}return __extends(t,n),t.prototype.associations=function(){return n.prototype.associations.call(this).concat(["pagination-color","pagination-bg","pagination-border","pagination-hover-color","pagination-hover-bg","pagination-hover-border","pagination-active-color","pagination-active-bg","pagination-active-border","pagination-disabled-color","pagination-disabled-bg","pagination-disabled-border"])},t}(t);n.Pagination=ht})(Customization||(Customization={})),function(n){var t=function(){function n(n,t){this.version=n;this.variableGroups=t}return n}();n.LessChangeset=t}(Customization||(Customization={})),function(n){var i,r,t;(function(n){n[n.SizeConstant=0]="SizeConstant";n[n.SizeComputed=1]="SizeComputed";n[n.ColorConstant=2]="ColorConstant";n[n.ColorComputed=3]="ColorComputed";n[n.FontFamily=4]="FontFamily";n[n.FontSizeConstant=5]="FontSizeConstant";n[n.FontSizeComputed=6]="FontSizeComputed"})(i=n.Type||(n.Type={})),function(n){n[n.BoxModel=0]="BoxModel";n[n.TypographyModel=1]="TypographyModel";n[n.ColorModel=2]="ColorModel"}(r=n.Model||(n.Model={}));t=function(){function n(){}return n}();n.LessVariable=t}(Customization||(Customization={})),function(n){var t=function(){function n(n,t){this.name=n;this.variables=t}return n}();n.LessVariableGroup=t}(Customization||(Customization={})),function(n){var i=function(){function n(n,t){this.name=n;this.variables=t}return n}(),t;n.LessVariableGroupModel=i;t=function(){function t(n,t){var i=this;this.value=ko.observable(n.value);this.variable=n;this.name=n.name;this.invalid=ko.observable(!1);this.templateName=this.determineTemplate(this.variable.value);this.value.subscribe(function(r){n.value=r;i.invalid(!t.isVariableValid(n.name,n.type,r))})}return t.prototype.determineTemplate=function(){return this.variable.type==n.Type.ColorConstant?"Color":"Simple"},t}();n.LessVariableModel=t}(Customization||(Customization={})),function(n){var t=function(){function n(n){this.changeset=n}return n.prototype.isVariableValid=function(n,t,i){var r="",f=this.extractVariablesFromValue(i),e,u;f&&(r=this.buildLessString(r,f));r=r+this.getLessVariableString(n,i);e=new less.Parser;try{e.parse(r,function(n,t){t.toCSS();u=!0})}catch(o){u=!1}return u},n.prototype.isChangesetValid=function(n){var t=this,i=n.variableGroups.selectMany(function(n){return n.variables}).any(function(n){return!t.isVariableValid(n.name,n.type,n.value)});return!i},n.prototype.buildLessString=function(n,t){var i=this;return t.forEach(function(t){var r=i.searchByName(t.substring(1)),u;r&&(u=i.extractVariablesFromValue(r.value),u&&(n=i.buildLessString(n,u)),n=n+i.getLessVariableString(r.name,r.value))}),n},n.prototype.getLessVariableString=function(n,t){return"@"+n+":"+t+";"},n.prototype.searchByName=function(n){for(var r,i,e,u,t=0,f=this.changeset.variableGroups.length;t<f;t++)for(r=this.changeset.variableGroups[t],i=0,e=r.variables.length;i<e;i++)if(u=r.variables[i],u.name==n)return u;return null},n.prototype.extractVariablesFromValue=function(n){var t=n.match(/@[\w\d-]+/g);return t&&t.length>0?t:null},n}();n.LessValidator=t}(Customization||(Customization={})),function(n){var t=function(){function n(n,t){this.sectionTitle="Publish";this.templateName="ChangesSectionPaneTemplate";this.httpClient=n;this.validationSummary=t;this.isEnabled=ko.observable(!0);this.onChangesDiscraded=this.onChangesDiscraded.bind(this);this.onChangesReset=this.onChangesReset.bind(this);this.onChangesPublished=this.onChangesPublished.bind(this);this.onRequestErrors=this.onRequestErrors.bind(this)}return n.prototype.onChangesPublished=function(){this.validationSummary.addNotificationMessage("Changes were published.")},n.prototype.onChangesDiscraded=function(){window.location.reload()},n.prototype.onChangesReset=function(){window.location.reload()},n.prototype.onRequestErrors=function(n){this.validationSummary.addErrorMessages(n)},n.prototype.publishChanges=function(){this.validationSummary.clearAllMessages();var n=this.httpClient.request("customization/changeset/publish");n.done(this.onChangesPublished);n.fail(this.onRequestErrors)},n.prototype.discardChanges=function(){this.validationSummary.clearAllMessages();var n=this.httpClient.request("customization/changeset/discard");n.done(this.onChangesDiscraded);n.fail(this.onRequestErrors)},n}();n.PublishSection=t}(Customization||(Customization={})),function(n){var t=function(){function t(n,t){this.sectionTitle="Styles";this.templateName="StylesSectionPaneTemplate";this.httpClient=n;this.validationSummary=t;this.onChangesetLoaded=this.onChangesetLoaded.bind(this);this.onPreviewReadyInternal=this.onPreviewReadyInternal.bind(this);this.onRequestErrors=this.onRequestErrors.bind(this);this.beginElementSelection=this.beginElementSelection.bind(this);this.endElementSelection=this.endElementSelection.bind(this);this.updateSearch=this.updateSearch.bind(this);this.preview=this.preview.bind(this);this.scheduleStylesPreview=this.scheduleStylesPreview.bind(this);this.search=this.search.bind(this);this.displayGroups=this.displayGroups.bind(this);this.isEnabled=ko.observable(!0);this.selectedElement=ko.observable(null);this.searchText=ko.observable("");this.searchText.subscribe(this.updateSearch);this.elements=[];this.changeset=ko.observable();this.onBeginSelection=new ko.subscribable;this.onPreviewReady=new ko.subscribable;var i=this.httpClient.request("customization/changeset/styles/load");i.done(this.onChangesetLoaded);i.fail(this.onRequestErrors)}return t.prototype.updateSearch=function(){this.selectedElement(null)},t.prototype.registerElements=function(){this.registerElement(new n.Pagination);this.registerElement(new n.Pills);this.registerElement(new n.CodeBlock);this.registerElement(new n.LinkButton);this.registerElement(new n.LargeButton);this.registerElement(new n.SmallButton);this.registerElement(new n.ExtraSmallButton);this.registerElement(new n.RegularButton);this.registerElement(new n.ButtonGroup);this.registerElement(new n.Panel);this.registerElement(new n.Form);this.registerElement(new n.FormLegend);this.registerElement(new n.Table);this.registerElement(new n.Text);this.registerElement(new n.Label);this.registerElement(new n.Blockquote);this.registerElement(new n.Navbar);this.registerElement(new n.Heading1);this.registerElement(new n.Heading2);this.registerElement(new n.Heading3);this.registerElement(new n.Heading4);this.registerElement(new n.Heading5);this.registerElement(new n.Heading6);this.registerElement(new n.HeaderZone);this.registerElement(new n.ContentZone);this.registerElement(new n.AsideFirstZone);this.registerElement(new n.FooterZone)},t.prototype.registerElement=function(n){var t=this.search(function(t){return n.associations().contains(t.name)});n.variableGroups=t;this.elements.push(n)},t.prototype.onChangesetLoaded=function(t){this.changeset(t);this.validator=new n.LessValidator(t);this.registerElements()},t.prototype.onRequestErrors=function(n){this.validationSummary.addErrorMessages(n)},t.prototype.onPreviewReadyInternal=function(n){this.onPreviewReady.notifySubscribers(n)},t.prototype.preview=function(){var t,n;this.validationSummary.clearAllMessages();t=!this.validator.isChangesetValid(this.changeset());t?this.validationSummary.addErrorMessage("One or more variables contain invalid values. Please make correction and try again."):(n=this.httpClient.request("customization/changeset/styles/preview",this.changeset()),n.done(this.onPreviewReadyInternal),n.fail(this.onRequestErrors))},t.prototype.scheduleStylesPreview=function(){clearTimeout(this.stylePreviewTimeoutHandle);this.stylePreviewTimeoutHandle=setTimeout(this.preview,1e3)},t.prototype.displayGroups=function(){var n=this;return this.search(function(t){var i=n.searchText();return i===""||t.name.indexOf(i)>=0||t.value.indexOf(i)>=0})},t.prototype.beginElementSelection=function(){this.onBeginSelection.notifySubscribers();this.selectedElement(null)},t.prototype.endElementSelection=function(n){n!=null&&this.selectedElement(n)},t.prototype.clearElementSelection=function(){this.selectedElement(null)},t.prototype.search=function(t){var r=this,i=[];return this.changeset()?(this.changeset().variableGroups.forEach(function(u){var f=u.variables.where(t).select(function(t){var i=new n.LessVariableModel(t,r.validator);return i.value.subscribe(r.scheduleStylesPreview),i});f.length>0&&i.push(new n.LessVariableGroupModel(u.name,f))}),i):i},t.prototype.discardUnpublishedStyles=function(){this.validationSummary.clearAllMessages();var n=this.httpClient.request("customization/changeset/styles/reset");n.done(function(){return window.location.reload()});n.fail(this.onRequestErrors)},t}();n.StylesSection=t}(Customization||(Customization={})),function(n){var t=function(){function n(n){this.id=n.id;this.name=n.name;this.isPublished=n.isPublished;this.isEdited=ko.observable(n.isEdited);this.displayName=n.displayName;this.description=n.description;this.content=ko.observable(n.content)}return n}();n.Template=t}(Customization||(Customization={})),function(n){var t=function(){function t(n,t,i){this.docsRegexp="/docs/services/.+/operations/.+$";this.productsRegexp=/\/products\/.+$/;this.sectionTitle="Templates";this.templateName="TemplatesSectionPaneTemplate";this.httpClient=t;this.validationSummary=i;this.toolbox=n;this.isEnabled=ko.observable(!0);this.select=this.select.bind(this);this.onTemplateLoaded=this.onTemplateLoaded.bind(this);this.onHttpRequestFailure=this.onHttpRequestFailure.bind(this);this.onTemplatesReset=this.onTemplatesReset.bind(this);this.onNavigationLinksLoaded=this.onNavigationLinksLoaded.bind(this);this.productLink=ko.observable("");this.appLink=ko.observable("");this.issueLink=ko.observable("");this.apiOperationLink=ko.observable("");this.loadTemplatesLinks()}return t.prototype.onTemplateLoaded=function(t){var i=new n.Template(t);this.updateTemplateInfo(i);this.toolbox.openTemplate(i)},t.prototype.onNavigationLinksLoaded=function(n){n&&(n.productLink&&this.productLink(n.productLink),n.appLink&&this.appLink(n.appLink),n.issueLink&&this.issueLink(n.issueLink),n.apiOperationLink&&this.apiOperationLink(n.apiOperationLink),n.templatesInfo&&(this.templatesInfo=ko.observableArray(n.templatesInfo)))},t.prototype.onHttpRequestFailure=function(n){this.validationSummary.clearAllIssues();this.validationSummary.takeAllIssues(apiphany.Core.stringsToMessages(n))},t.prototype.onTemplatesReset=function(){window.location.reload()},t.prototype.loadTemplatesLinks=function(){this.toolbox.httpClient.request("customization/changeset/templates/navigationLinks").done(this.onNavigationLinksLoaded).fail(this.onHttpRequestFailure)},t.prototype.updateTemplateInfo=function(n){if(this.templatesInfo){var t=_.where(this.templatesInfo(),{name:n.name});t&&t.length===1&&(t[0].isEdited=n.isEdited())}},t.prototype.isTemplateEdited=function(n){var t=_.where(this.templatesInfo(),{name:n});return t&&t.length===1?t[0].isEdited:!1},t.prototype.select=function(n){this.toolbox.httpClient.request("customization/changeset/templates/{0}".format(n)).done(this.onTemplateLoaded).fail(this.onHttpRequestFailure)},t.prototype.addQueryParameter=function(n,t,i){var r="?";return n.indexOf("?")>=0&&(r="&"),n+(""+r+t+"="+i)},t.prototype.navigateToTemplatePage=function(t,i,r){if(t&&i){var f=this.addQueryParameter(t,n.editTemplateQueryParameter,i),u=window.location.href.toLowerCase();u.indexOf(f.toLowerCase(),u.length-f.length)!==-1?this.select(i):r||u.indexOf(t.toLowerCase(),u.length-t.toLowerCase().length)===-1?r&&t.match(this.docsRegexp)&&u.match(this.docsRegexp)||t.match(this.productsRegexp)&&u.match(this.productsRegexp)?this.select(i):window.location.href=f:this.select(i)}},t.prototype.resetToDefault=function(){this.toolbox.httpClient.request("customization/changeset/templates/reset").done(this.onTemplatesReset).fail(this.onHttpRequestFailure)},t}();n.TemplatesSection=t}(Customization||(Customization={})),function(n){var t,i;n.dataModel=n.dataModel||{},function(n){n[n.Save=0]="Save";n[n.Publish=1]="Publish";n[n.Reset=2]="Reset";n[n.Discard=3]="Discard"}(t||(t={}));i=function(){function i(t,i){this.saveChangesMessage="You have attempted to close or navigate from template editor. You made changes to the template without clicking the Save button, your changes will be lost. Are you sure you want to close template editor?";this.toolbox=t;this.template=i;this.lastSavedTemplate=i.content();this.fullscreen=ko.observable(!1);this.hasChanges=ko.observable(!1);this.validationSummary=new apiphany.Core.UI.ValidationSummary;this.expand=this.expand.bind(this);this.collapse=this.collapse.bind(this);this.onTemplateUpdated=this.onTemplateUpdated.bind(this);this.onPreviewReady=this.onPreviewReady.bind(this);this.onChangeTemplate=new ko.subscribable;this.afterTemplateUpdated=this.afterTemplateUpdated.bind(this);this.resetTemplateToDefault=this.resetTemplateToDefault.bind(this);this.publishTemplateChanges=this.publishTemplateChanges.bind(this);this.discardTemplateChanges=this.discardTemplateChanges.bind(this);this.saveTemplateChanges=this.saveTemplateChanges.bind(this);this.checkUnsavedChanges=this.checkUnsavedChanges.bind(this);this.onHttpRequestFailure=this.onHttpRequestFailure.bind(this);this.initResize=this.initResize.bind(this);this.doDragY=this.doDragY.bind(this);this.doDragX=this.doDragX.bind(this);this.stopDrag=this.stopDrag.bind(this);this.confirmDlg=new n.ConfirmTemplateDialog("confirmTemplateDialog");window.addEventListener("beforeunload",this.checkUnsavedChanges,!1)}return i.prototype.doDragY=function(n){var t=this.startHeight+(this.startY-n.clientY);n.clientY>100&&t>this.defaultHeight&&(this.pane.style.height=t+"px")},i.prototype.doDragX=function(n){var t=this.startWidth-(this.startX-n.clientX);n.clientX>.5*this.defaultWidth&&t<1.5*this.defaultWidth&&($(".editor")[0].style.width=t+"px")},i.prototype.stopDrag=function(){document.onselectstart=null;document.documentElement.removeEventListener("mousemove",this.doDragY,!1);document.documentElement.removeEventListener("mousemove",this.doDragX,!1);document.documentElement.removeEventListener("mouseup",this.stopDrag,!1);this.codeEditor.resize();this.codeViewer.resize()},i.prototype.onTemplateUpdated=function(){var n=this.codeEditor.getContent();this.lastSavedTemplate!==n&&(this.hasChanges()||this.hasChanges(!0),this.previewTemplateContent(n))},i.prototype.previewTemplateContent=function(t){var s=$("#{0}".format(this.template.name)),u,f,h,e,o;if(s.length>0){var c=s.attr("id"),i="",r=s.attr("data-model-container");if(r){if(Object.keys(n.dataModel).length>1){f=n.dataModel;for(h in f)f.hasOwnProperty(h)&&(e=f[h],e&&e.hasOwnProperty(r)&&(u=e[r]))}else u=n.dataModel[0][r];u&&(o=_.find(u,function(n){return n.template===c}),o&&(i=JSON.stringify(o),this.codeViewer.setContent(JSON.stringify(o,null,"\t"))))}else i=JSON.stringify(n.dataModel[this.template.name]),this.codeViewer&&this.codeViewer.setContent(JSON.stringify(n.dataModel[this.template.name],null,"\t"));this.lastPreviewModel=i;this.toolbox.httpClient.request("customization/changeset/templates/{0}/preview".format(c),{templateContent:t,templateModel:i}).done(this.onPreviewReady).fail(this.onHttpRequestFailure)}},i.prototype.onPreviewReady=function(n){this.template.content(this.codeEditor.getContent());this.validationSummary.clearAllIssues();var t=$("#{0}".format(this.template.name));t.length>0&&this.onChangeTemplate.notifySubscribers(n)},i.prototype.onHttpRequestFailure=function(n){var t,i;for(this.validationSummary.clearAllIssues(),t=0;t<n.length;t++)i=n[t],this.validationSummary.addTemplatedErrorMessage("simpleValidationSummaryTextItemTemplate",i)},i.prototype.initResize=function(){var n=this,t;this.defaultHeight=parseInt(document.defaultView.getComputedStyle(this.pane).height,10);t=$(".editor")[0];this.defaultWidth=t.offsetWidth;$(".toolbox-bottom-pane-row-resizer")[0].addEventListener("mousedown",function(t){return document.onselectstart=function(){return!1},document.documentElement.addEventListener("mouseup",n.stopDrag,!1),n.startHeight=parseInt(document.defaultView.getComputedStyle(n.pane).height,10),n.startY=t.clientY,document.documentElement.addEventListener("mousemove",n.doDragY,!1),!1},!1);$(".toolbox-bottom-pane-col-resizer")[0].addEventListener("mousedown",function(i){return document.onselectstart=function(){return!1},document.documentElement.addEventListener("mouseup",n.stopDrag,!1),n.startWidth=t.offsetWidth,n.startX=i.clientX,document.documentElement.addEventListener("mousemove",n.doDragX,!1),!1},!1);this.codeEditor.resize();this.codeViewer.resize()},i.prototype.takeCodeEditor=function(n){this.codeEditor=n;n.setReadOnly(!1);n.setContent(this.template.content());n.onChanged.subscribe(this.onTemplateUpdated)},i.prototype.takeCodeViewer=function(n){this.codeViewer=n;this.codeViewer.setReadOnly(!0);this.previewTemplateContent(this.template.content());this.initResize()},i.prototype.hasCodeEditor=function(){return this.pane=$(".toolbox-bottom-pane")[0],!!this.codeEditor},i.prototype.hasCodeViewer=function(){return!!this.codeViewer},i.prototype.expand=function(){this.fullscreen(!0);this.lastHeight=this.pane.style.height;this.pane.style.height="100%";this.codeEditor.resize();this.codeViewer.resize()},i.prototype.collapse=function(){this.fullscreen(!1);this.pane.style.height=this.lastHeight;this.codeEditor.resize();this.codeViewer.resize()},i.prototype.retrySave=function(){this.saveTemplateChanges()},i.prototype.checkUnsavedChanges=function(){return this.hasChanges()?this.saveChangesMessage:undefined},i.prototype.isAllChangesSaved=function(){var n=this,t=this.checkUnsavedChanges();return t?(this.confirmDlg.setProperties("Are you sure you want to close template editor?",t,"Yes"),this.confirmDlg.show().done(function(t){t&&setTimeout(function(){n.hasChanges(!1);n.toolbox.closeBottomPane(!0)},500)}),!1):!0},i.prototype.refreshLocalTemplate=function(n){this.hasChanges(!1);this.lastSavedTemplate=n.content;this.template.content(n.content);this.template.isEdited(n.isEdited);this.codeEditor.setContent(this.template.content());this.toolbox.templatesSection.updateTemplateInfo(this.template);this.previewTemplateContent(this.lastSavedTemplate)},i.prototype.afterTemplateUpdated=function(n,i){var u=this,r=null;switch(i){case t.Save:this.refreshLocalTemplate(n);r="Template was saved";break;case t.Publish:this.template.isEdited(n.isEdited);this.toolbox.templatesSection.updateTemplateInfo(this.template);r="Template was published";break;case t.Reset:this.refreshLocalTemplate(n);r="Template was reset";break;case t.Discard:this.refreshLocalTemplate(n);r="Template was discarded"}this.validationSummary.addNotificationMessage(r);setTimeout(function(){u.validationSummary.clearAllMessages()},3e3)},i.prototype.onTemplateUpdateFailure=function(n,i){var r="",u;switch(i){case t.Save:r="Save Error: ";break;case t.Publish:r="Publish Error: ";break;case t.Reset:r="Reset Error: ";break;case t.Discard:r="Discard Error: "}this.validationSummary.clearAllIssues();u=n.join(";");i===t.Save&&u.indexOf("Template Error:")!==-1?this.validationSummary.addErrorMessage(u):(this.validationSummary.addErrorMessage(r+u),this.validationSummary.addErrorMessage("Please check internet connection and try again."))},i.prototype.saveTemplateChanges=function(){var n=this,i=this.codeEditor.getContent();this.toolbox.httpClient.request("customization/changeset/templates/{0}/save".format(this.template.name),{templateContent:i,templateModel:this.lastPreviewModel}).done(function(i){n.afterTemplateUpdated(i,t.Save)}).fail(function(i){return n.onTemplateUpdateFailure(i,t.Save)})},i.prototype.publishTemplateChanges=function(){var n=this;if(!this.validationSummary.hasIssues()){if(this.hasChanges()){this.confirmDlg.setProperties("Publish template","You have unsaved changes. Would you like to save them before publish?","Yes");this.confirmDlg.show().done(function(t){t&&(n.saveTemplateChanges(),setTimeout(function(){return n.publishTemplateChanges()},500))});return}this.confirmDlg.setProperties("Publish template","Are you sure you want to make this template live on the developer portal?","Yes");this.confirmDlg.show().done(function(i){i&&n.toolbox.httpClient.request("customization/changeset/templates/{0}/publish".format(n.template.name)).done(function(i){n.afterTemplateUpdated(i,t.Publish)}).fail(function(i){return n.onTemplateUpdateFailure(i,t.Publish)})})}},i.prototype.resetTemplateToDefault=function(){var n=this;this.confirmDlg.setProperties("Reset template","Are you sure you want to discard all changes and revert to the default template?","Yes");this.confirmDlg.show().done(function(i){i&&n.toolbox.httpClient.request("customization/changeset/templates/{0}/reset".format(n.template.name)).done(function(i){n.afterTemplateUpdated(i,t.Reset)}).fail(function(i){return n.onTemplateUpdateFailure(i,t.Reset)})})},i.prototype.discardTemplateChanges=function(){var n=this;this.confirmDlg.setProperties("Discard changes","Are you sure you want to discard changes and revert to the most recent published template?","Yes");this.confirmDlg.show().done(function(i){i&&n.toolbox.httpClient.request("customization/changeset/templates/{0}/discard".format(n.template.name)).done(function(i){n.afterTemplateUpdated(i,t.Discard)}).fail(function(i){return n.onTemplateUpdateFailure(i,t.Discard)})})},i}();n.TemplateEditingPane=i}(Customization||(Customization={}));var Dropdown=function(){function n(n){this.element=n;this.dispose=this.dispose.bind(this);this.onBlur=this.onBlur.bind(this);this.onKeyDown=this.onKeyDown.bind(this);ko.utils.domNodeDisposal.addDisposeCallback(n,this.dispose);this.element.dropdownBox=this;document.addEventListener("focus",this.onBlur,!0);document.addEventListener("click",this.onBlur,!0);document.addEventListener("keydown",this.onKeyDown,!0)}return n.prototype.onBlur=function(n){if(this.isOpen()){for(var t=n.target;t&&t!=this.element;)t=t.parentElement;t!=this.element&&this.close()}},n.prototype.onKeyDown=function(n){n.keyCode===27&&this.close()},n.prototype.isOpen=function(){return this.element.classList.contains("open")},n.prototype.toggle=function(){this.isOpen()?this.close():this.open()},n.prototype.open=function(){this.element.classList.add("open");var n=this.element.querySelector("[dropdownbox] [focus]");n&&n.focus&&n.focus()},n.prototype.close=function(){this.element.classList.remove("open")},n.prototype.dispose=function(){document.removeEventListener("focus",this.onBlur.bind(this),!0);document.removeEventListener("click",this.onBlur.bind(this),!0);document.removeEventListener("keydown",this.onKeyDown.bind(this),!0)},n}(),DropdownToggle=function(){function n(n,t){t===void 0&&(t="toggle");this.element=n;this.toggleMode=t;do n=n.parentElement,n&&(this.dropdownBox=n.dropdownBox);while(n&&!this.dropdownBox);n.onclick=this.onClick.bind(this);n.onkeydown=this.onKeyDown.bind(this)}return n.prototype.onClick=function(n){n.preventDefault();this.trigger()},n.prototype.trigger=function(){switch(this.toggleMode){case"open":this.dropdownBox.open();break;case"close":this.dropdownBox.close();break;default:this.dropdownBox.toggle()}},n.prototype.onKeyDown=function(n){switch(n.keyCode){case 13:break;case 27:this.dropdownBox.close();break;default:this.toggleMode==="open"&&this.dropdownBox.open()}},n}(),TagInput=function(){function n(n){this.selectedTags=n.selectedTags;this.availableTags=n.availableTags;this.placeholder=n.placeholder||"";this.onSumbit=n.onSubmit;this.removeTag=this.removeTag.bind(this);this.selectItem=this.selectItem.bind(this);this.refresh=this.refresh.bind(this);this.filteredTags=ko.observableArray([]);this.filter=ko.observable("");this.filter.subscribe(this.scheduleRefresh.bind(this));this.control=ko.observable();this.refresh()}return n.prototype.removeTag=function(n){this.selectedTags.splice(this.selectedTags.indexOf(n),1);this.refresh();this.control().focus()},n.prototype.selectItem=function(n){this.filter("");this.selectedTags.push(n);this.refresh();this.control().focus()},n.prototype.onInputKeyDown=function(n,t){return t.keyCode===8&&this.filter()===""&&this.selectedTags().length>0&&this.removeTag(this.selectedTags()[this.selectedTags().length]),t.keyCode===13&&this.onSumbit()(),!0},n.prototype.scheduleRefresh=function(n){var t=this;n===void 0&&(n="");clearTimeout(this.refreshTimeout);this.refreshTimeout=setTimeout(function(){return t.refresh(n)},100)},n.prototype.refresh=function(n){var t=this;n===void 0&&(n="");this.filteredTags(this.availableTags().filter(function(n){return!t.selectedTags().some(function(t){return t.toLowerCase()===n.toLowerCase()})}).filter(function(t){return t.toLowerCase().indexOf(n.toLowerCase())>=0}))},n}(),Filter=function(){function n(){var i=this,n,t;this.readSelectedTags=this.readSelectedTags.bind(this);this.writeSelectedTags=this.writeSelectedTags.bind(this);this.initAvailableTags=ko.observable("");this.initSelectedTags=ko.observable("");this.selectedTags=ko.observableArray([]);this.availableTags=ko.observableArray([]);this.groupBy=ko.observable();this.collapsed=ko.observable(!0);this.apply=ko.observable();this.pattern=ko.observable();this.result=ko.pureComputed({read:this.readSelectedTags,write:this.writeSelectedTags});this.initAvailableTags.subscribe(function(n){var t=n.split(",").filter(function(n){return n!=""});i.availableTags(t)});this.toggle=this.toggle.bind(this);this.open=this.open.bind(this);this.groupByTag=this.groupByTag.bind(this);this.list=this.list.bind(this);n=sessionStorage.getItem("filterControl");n&&(t=JSON.parse(n),this.collapsed(t.collapsed));this.collapsed.subscribe(function(n){sessionStorage.setItem("filterControl",JSON.stringify({collapsed:n}))})}return n.prototype.readSelectedTags=function(){return this.selectedTags().join(",")},n.prototype.writeSelectedTags=function(n){var t=n.split(",").filter(function(n){return n!=""});this.selectedTags(t)},n.prototype.toggle=function(){this.collapsed(!this.collapsed())},n.prototype.open=function(){this.collapsed(!1)},n.prototype.groupByTag=function(){this.groupBy("tag");this.apply()()},n.prototype.list=function(){this.groupBy(null);this.apply()()},n}(),Customization;(function(n){var a=function(){function n(){}return n.bootstrap=function(n,t){ko.components.register("app-actions",{viewModel:function(i){var r=this;i&&(this.editUrl=t.replace("appId",i.appId),this.appId=i.appId,this.clickDelete=function(t,i){return confirm(n)?!0:(i.stopImmediatePropagation(),i.preventDefault(),!1)},this.publishUrl=ko.computed(function(){return r.editUrl.replace("/Edit/","/Publish/")}),this.deleteUrl=ko.computed(function(){return r.editUrl.replace("/Edit/","/Delete/")}))},template:appActionsTemplate.innerHTML});ko.components.register("subscription-cancel",{viewModel:function(n){n&&(this.subscriptionId=n.subscriptionId,this.cancelId="cancel_{0}".format(n.subscriptionId),this.cancelUrl=n.cancelUrl);this.confirmCancel=function(){return confirm(apiphany.Localizer.getString("SubscriptionCancelConfirmation"))?!0:(event.stopImmediatePropagation(),event.preventDefault(),!1)}},template:subscriptionCancelTemplate.innerHTML})},n}(),i,r,u,f,e,o,s,h,c,t,l;n.UserProfile=a;i=function(){function n(){}return n.bootstrap=function(){ko.components.register("providers",{viewModel:function(){},template:providersTemplate.innerHTML})},n}();n.Providers=i;r=function(){function n(){}return n.bootstrap=function(){ko.components.register("paging-control",{viewModel:function(){},template:pagingTemplate.innerHTML})},n}();n.PagingControl=r;u=function(){function n(){}return n.bootstrap=function(){ko.components.register("search-control",{viewModel:function(){},template:searchControlTemplate.innerHTML})},n}();n.SearchControl=u;f=function(){function n(){}return n.bootstrap=function(){ko.components.register("filter-control",{viewModel:Filter,template:filterControlTemplate.innerHTML})},n}();n.FilterControl=f;e=function(){function n(){}return n.bootstrap=function(){ko.bindingHandlers.editable={init:function(n,t){var u=t(),i=function(){u(n.innerText)},r=function(n){n.keyCode===13&&n.preventDefault()};n.addEventListener("keydown",r);n.addEventListener("input",i);ko.utils.domNodeDisposal.addDisposeCallback(n,function(){n.removeEventListener("keydown",r);n.removeEventListener("input",i)})}};ko.bindingHandlers.dropdownBox={init:function(n){var t=new Dropdown(n)}};ko.bindingHandlers.dropdownBoxToggle={init:function(n,t){var i=ko.unwrap(t()),r=new DropdownToggle(n,i)}};ko.bindingHandlers.control={init:function(n,t){var i=t();i(n)}};ko.components.register("tag-input",{viewModel:TagInput,template:tagInputTemplate.innerHTML})},n}();n.TagControl=e;o=function(){function n(){}return n.bootstrap=function(){ko.components.register("subscribe-button",{viewModel:function(){},template:subscribeButtonTemplate.innerHTML});ko.applyBindings(undefined,document.body)},n}();n.SubscribeButton=o;s=function(){function n(){}return n.bootstrap=function(){ko.components.register("basic-signin",{viewModel:function(){},template:basicSignInTemplate.innerHTML})},n}();n.BasicSignIn=s;h=function(){function n(){}return n.bootstrap=function(){ko.components.register("sign-up",{viewModel:function(){this.verdictLevel=ko.observable(-1);t.replaceElement("captchaPlaceHolder","captcha")},template:signUpTemplate.innerHTML})},n}();n.SignUp=h;c=function(){function t(){}return t.bootstrap=function(){ko.components.register("captcha",{viewModel:n.CaptchaViewModel,template:'\n<div class="form-group">\n    <div id="ispHIPHIP"><\/div>\n    <div id="ispHIPScript" style="display: inline"><\/div>\n    <input type="hidden" id="Solution" name="Solution" />\n    <input type="hidden" id="Token" name="Token" />\n    <input type="hidden" id="Type" name="Type" />\n    <input type="hidden" id="FlowId" name="FlowId" data-bind="value: encryptedFlowId" />\n<\/div>'})},t}();n.Captcha=c;t=function(){function n(){}return n.replaceElement=function(n,t){var i=document.getElementById(n),r=document.getElementById(t);i&&i.parentNode.replaceChild(r.childNodes[1].cloneNode(!0),i)},n}();n.PlaceHolderHelper=t;l=function(){function n(n){this.encryptedFlowId=n.encryptedFlowId;var t=document.createElement("script");t.src="/Themes/Portals.Themes.Bootstrap/Scripts/HipObject.js";t.onload=function(){var t=document.createElement("script"),i;t.src=n.hipUrl;$("#captcha").closest("form").submit(function(){WLSPHIP0.verify(fillHipData,"")});WLSPHIP0.error="0";WLSPHIP0.left=0;WLSPHIP0.inputWidth=$("#ispHIPHIP").width();WLSPHIP0.cssSet={cssCdHIPInput:"form-control captcha-input",cssCdHIPMenu:"",cssCdHIPLink:"",cssCdHIPError:"",cssCdHIPErrorImg:""};WLSPHIP0.postLoad=function(){var t=$("#ispHIPHIP").find("input[type=text]");t.removeAttr("style");t.attr("placeholder",n.placeholder)};i=document.getElementById("ispHIPScript");i.appendChild(t)};document.body.appendChild(t)}return n}();n.CaptchaViewModel=l})(Customization||(Customization={}));ko.bindingHandlers.submitCallback={init:function(n,t){var i=t();i(function(){n.submit()})}},function(n){var i=function(){function n(){this.html=ko.observable("")}return n.prototype.subscribeToPanelChange=function(n){var t=this;n&&n.onChangeTemplate.subscribe(function(n){t.html(n)})},n}(),t;n.EditPreview=i;t=function(){function t(t,i){this.httpClient=t;this.editorSections=ko.observableArray([]);this.commandSections=ko.observableArray([]);this.activeSection=ko.observable(null);this.bottomPane=ko.observable();this.toggleSection=this.toggleSection.bind(this);this.closeActiveSection=this.closeActiveSection.bind(this);this.isSectionActive=this.isSectionActive.bind(this);this.closeBottomPane=this.closeBottomPane.bind(this);this.validationSummary=new apiphany.Core.UI.ValidationSummary;this.working=t.sendingRequest;this.stylesSection=new n.StylesSection(this.httpClient,this.validationSummary);this.editorSections.push(this.stylesSection);i.advancedCustomizations&&(this.templatesSection=new n.TemplatesSection(this,this.httpClient,this.validationSummary),this.editorSections.push(this.templatesSection));this.commandSections.push(new n.PublishSection(this.httpClient,this.validationSummary))}return t.prototype.isSectionActive=function(n){return n===this.activeSection()},t.prototype.openTemplate=function(t){this.closeActiveSection();var i=new n.TemplateEditingPane(this,t);this.bottomPane(i);$("#ap-container").addClass("yield-bottom-pane")},t.prototype.toggleSection=function(n){this.validationSummary.clearAllMessages();this.closeBottomPane()&&(this.isSectionActive(n)?this.closeActiveSection():this.activeSection(n))},t.prototype.closeActiveSection=function(){this.activeSection(null);this.validationSummary.clearAllMessages()},t.prototype.closeBottomPane=function(n){n===void 0&&(n=undefined);var t=this.bottomPane();return t?t.hasChanges()&&!t.isAllChangesSaved()?!1:(n&&this.onClose&&this.onClose(),window.removeEventListener("beforeunload",t.checkUnsavedChanges,!1),$("#ap-container").removeClass("yield-bottom-pane"),this.bottomPane(null),!0):!0},t}();n.Toolbox=t}(Customization||(Customization={})),function(n){var t,i;n.editTemplateQueryParameter="startEditTemplate";t=function(){function t(){}return t.hideColorpickers=function(){var n=document.activeElement;n.tagName.toUpperCase()==="INPUT"&&document.activeElement.blur()},t.bootstrap=function(i){var h={advancedCustomizations:i.advancedCustomizations},a=new apiphany.Core.Fetcher(i.appPath,i.antiForgeryToken,i.activityId),f=!1,r=new n.Toolbox(a,h),u=r.stylesSection,e,c,l,o,s;u.onBeginSelection.subscribe(function(){f=!0;r.closeActiveSection();u.elements.forEach(function(n){var t=$("#ap-container "+n.selector);$(n).hasClass("element")||(t.addClass("element"),t.data("element",n))})});$("#ap-container").on("mouseover","*",function(n){f&&(n.preventDefault(),n.stopPropagation(),$(".element").removeClass("element-active"),$(n.target).closest(".element").addClass("element-active"))});$("#ap-container").on("click","*",function(n){if(f){n.preventDefault();n.stopPropagation();var t=$(n.target).closest(".element").data("element");u.endElementSelection(t);r.activeSection(u);f=!1;$(".element").removeClass("element-active")}});u.onPreviewReady.subscribe(function(){var t=$('link[title="bootstrap_preview_style"]'),n=t.attr("href"),i=n.indexOf("?");i!==-1&&(n=n.substr(0,i));n+="?"+(new Date).getTime();t.attr("href",n)});ko.components.register("toolbox",{viewModel:function(){return r},template:ToolboxTemplate.innerHTML});e=new n.EditPreview;ko.components.register("editpreview",{viewModel:function(){return e},template:"<div id='previewContent' data-bind='content: html'><\/div>"});c=$("toolbox")[0];ko.applyBindingsToNode(c,{component:"toolbox"},null);l=$("[name='editpreview']");l.length&&r.bottomPane.subscribe(function(t){if(t){var i=$("#{0}".format(t.template.name))[0];i&&(e=new n.EditPreview,e.subscribeToPanelChange(t),ko.applyBindingsToNode(i,{component:"editpreview"},null),ko.bindingHandlers.content={update:function(n,t,i,r,u){ko.utils.setHtml(n,t());ko.applyBindingsToDescendants(u,n)}})}});h.advancedCustomizations&&r.templatesSection&&(o={},location.search.substr(1).split("&").forEach(function(n){var t=n.split("=");o[t[0]]=t[1]}),s=o.startEditTemplate,s&&(r.templatesSection.select(s),r.onClose=t.removeParameterFromQueryString))},t.removeParameterFromQueryString=function(){var r=n.editTemplateQueryParameter+"=[^&]*&|$",i=new RegExp(r).exec(location.search),t;i&&(t=location.search.replace(i[0]||i.input,""),t==="?"&&(t=""),location.search=t)},t}();n.Root=t;i=function(){function n(n){this.elementId=n;this.show=this.show.bind(this);this.setProperties=this.setProperties.bind(this);this.clickYes=this.clickYes.bind(this);this.clickNo=this.clickNo.bind(this);this.title=ko.observable();this.textContent=ko.observable();this.btnYesText=ko.observable();this.btnNoText=ko.observable()}return n.prototype.setProperties=function(n,t,i,r){r===void 0&&(r="No");this.title(n);this.textContent(t);this.btnYesText(i);this.btnNoText(r)},n.prototype.show=function(){var n=$("#{0}".format(this.elementId));return n.modal(),this.dialogResult=$.Deferred(),this.dialogResult},n.prototype.clickYes=function(){$("#{0}".format(this.elementId)).modal("hide");this.dialogResult.resolve(!0)},n.prototype.clickNo=function(){this.dialogResult.resolve(!1)},n}();n.ConfirmTemplateDialog=i}(Customization||(Customization={}));ko.bindingHandlers.colorpicker={init:function(n,t){function f(n){var t,i;n.colorpicker("reposition");t=n.data("colorpicker")&&n.data("colorpicker").picker;t&&(i=t.offset(),t.offset({top:i.top-document.body.scrollTop}))}var i=$(n),r=$('<div style="display: block; width: 100 %; height: 0;"><\/div>').insertAfter(i),u=!1;i.on("focus",function(){var n=r.colorpicker({format:"hex",align:"left"});n.on("showPicker",function(){u=!0;r.colorpicker("setValue",i.val());f(r)});n.on("changeColor",function(n){if(u)u=!1;else{i.val(n.color.toHex());var r=t();ko.isWriteableObservable(r)&&r(n.color.toHex())}});r.colorpicker("show")});i.on("blur",function(){r.colorpicker().off("showPicker");r.colorpicker().off("changeColor");r.colorpicker("destroy")});i.on("keydown",function(n){var t=n.which||n.keyCode;t==13&&i.blur()})}},function(n){"use strict";typeof exports=="object"?module.exports=n(window.jQuery):typeof define=="function"&&define.amd?define(["jquery"],n):window.jQuery&&!window.jQuery.fn.colorpicker&&n(window.jQuery)}(function(n){"use strict";var t=function(t,i){this.value={h:0,s:0,b:0,a:1};this.origFormat=null;i&&n.extend(this.colors,i);t&&(t.toLowerCase!==undefined?(t=t+"",this.setColor(t)):t.h!==undefined&&(this.value=t))},r,i;t.prototype={constructor:t,colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",transparent:"transparent"},_sanitizeNumber:function(n){return typeof n=="number"?n:isNaN(n)||n===null||n===""||n===undefined?1:n.toLowerCase!==undefined?parseFloat(n):1},isTransparent:function(n){return n?(n=n.toLowerCase().trim(),n==="transparent"||n.match(/#?00000000/)||n.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/)):!1},rgbaIsTransparent:function(n){return n.r===0&&n.g===0&&n.b===0&&n.a===0},setColor:function(n){n=n.toLowerCase().trim();n&&(this.value=this.isTransparent(n)?{h:0,s:0,b:0,a:0}:this.stringToHSB(n)||{h:0,s:0,b:0,a:1})},stringToHSB:function(t){var u,i,r;return t=t.toLowerCase(),typeof this.colors[t]!="undefined"&&(t=this.colors[t],u="alias"),i=this,r=!1,n.each(this.stringParsers,function(n,f){var o=f.re.exec(t),e=o&&f.parse.apply(i,[o]),s=u||f.format||"rgba";return e?(r=s.match(/hsla?/)?i.RGBtoHSB.apply(i,i.HSLtoRGB.apply(i,e)):i.RGBtoHSB.apply(i,e),i.origFormat=s,!1):!0}),r},setHue:function(n){this.value.h=1-n},setSaturation:function(n){this.value.s=n},setBrightness:function(n){this.value.b=1-n},setAlpha:function(n){this.value.a=parseInt((1-n)*100,10)/100},toRGB:function(n,t,i,r){n||(n=this.value.h,t=this.value.s,i=this.value.b);n*=360;var e,o,s,f,u;return n=n%360/60,u=i*t,f=u*(1-Math.abs(n%2-1)),e=o=s=i-u,n=~~n,e+=[u,f,0,0,f,u][n],o+=[f,u,u,f,0,0][n],s+=[0,0,f,u,u,f][n],{r:Math.round(e*255),g:Math.round(o*255),b:Math.round(s*255),a:r||this.value.a}},toHex:function(n,t,i,r){var u=this.toRGB(n,t,i,r);return this.rgbaIsTransparent(u)?"transparent":"#"+(16777216|parseInt(u.r)<<16|parseInt(u.g)<<8|parseInt(u.b)).toString(16).substr(1)},toHSL:function(n,t,i,r){n=n||this.value.h;t=t||this.value.s;i=i||this.value.b;r=r||this.value.a;var e=n,u=(2-t)*i,f=t*i;return f/=u>0&&u<=1?u:2-u,u/=2,f>1&&(f=1),{h:isNaN(e)?0:e,s:isNaN(f)?0:f,l:isNaN(u)?0:u,a:isNaN(r)?0:r}},toAlias:function(n,t,i,r){var f=this.toHex(n,t,i,r),u;for(u in this.colors)if(this.colors[u]===f)return u;return!1},RGBtoHSB:function(n,t,i,r){n/=255;t/=255;i/=255;var e,o,f,u;return f=Math.max(n,t,i),u=f-Math.min(n,t,i),e=u===0?null:f===n?(t-i)/u:f===t?(i-n)/u+2:(n-t)/u+4,e=(e+360)%6/6,o=u===0?0:u/f,{h:this._sanitizeNumber(e),s:o,b:f,a:this._sanitizeNumber(r)}},HueToRGB:function(n,t,i){return i<0?i+=1:i>1&&(i-=1),i*6<1?n+(t-n)*i*6:i*2<1?t:i*3<2?n+(t-n)*(2/3-i)*6:n},HSLtoRGB:function(n,t,i,r){var u;t<0&&(t=0);u=i<=.5?i*(1+t):i+t-i*t;var f=2*i-u,e=n+1/3,o=n,s=n-1/3,h=Math.round(this.HueToRGB(f,u,e)*255),c=Math.round(this.HueToRGB(f,u,o)*255),l=Math.round(this.HueToRGB(f,u,s)*255);return[h,c,l,this._sanitizeNumber(r)]},toString:function(n){n=n||"rgba";var t=!1;switch(n){case"rgb":return(t=this.toRGB(),this.rgbaIsTransparent(t))?"transparent":"rgb("+t.r+","+t.g+","+t.b+")";case"rgba":return t=this.toRGB(),"rgba("+t.r+","+t.g+","+t.b+","+t.a+")";case"hsl":return t=this.toHSL(),"hsl("+Math.round(t.h*360)+","+Math.round(t.s*100)+"%,"+Math.round(t.l*100)+"%)";case"hsla":return t=this.toHSL(),"hsla("+Math.round(t.h*360)+","+Math.round(t.s*100)+"%,"+Math.round(t.l*100)+"%,"+t.a+")";case"hex":return this.toHex();case"alias":return this.toAlias()||this.toHex();default:return t}},stringParsers:[{re:/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/,format:"rgb",parse:function(n){return[n[1],n[2],n[3],1]}},{re:/rgb\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*?\)/,format:"rgb",parse:function(n){return[2.55*n[1],2.55*n[2],2.55*n[3],1]}},{re:/rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,format:"rgba",parse:function(n){return[n[1],n[2],n[3],n[4]]}},{re:/rgba\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,format:"rgba",parse:function(n){return[2.55*n[1],2.55*n[2],2.55*n[3],n[4]]}},{re:/hsl\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*?\)/,format:"hsl",parse:function(n){return[n[1]/360,n[2]/100,n[3]/100,n[4]]}},{re:/hsla\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,format:"hsla",parse:function(n){return[n[1]/360,n[2]/100,n[3]/100,n[4]]}},{re:/#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,format:"hex",parse:function(n){return[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),1]}},{re:/#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,format:"hex",parse:function(n){return[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16),1]}}],colorNameToHex:function(n){return typeof this.colors[n.toLowerCase()]!="undefined"?this.colors[n.toLowerCase()]:!1}};r={horizontal:!1,inline:!1,color:!1,format:!1,input:"input",container:!1,component:".add-on, .input-group-addon",sliders:{saturation:{maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setBrightness"},hue:{maxLeft:0,maxTop:100,callLeft:!1,callTop:"setHue"},alpha:{maxLeft:0,maxTop:100,callLeft:!1,callTop:"setAlpha"}},slidersHorz:{saturation:{maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setBrightness"},hue:{maxLeft:100,maxTop:0,callLeft:"setHue",callTop:!1},alpha:{maxLeft:100,maxTop:0,callLeft:"setAlpha",callTop:!1}},template:'<div class="colorpicker dropdown-menu"><div class="colorpicker-saturation"><i><b><\/b><\/i><\/div><div class="colorpicker-hue"><i><\/i><\/div><div class="colorpicker-alpha"><i><\/i><\/div><div class="colorpicker-color"><div /><\/div><div class="colorpicker-selectors"><\/div><\/div>',align:"right",customClass:null,colorSelectors:null};i=function(i,u){if(this.element=n(i).addClass("colorpicker-element"),this.options=n.extend(!0,{},r,this.element.data(),u),this.component=this.options.component,this.component=this.component!==!1?this.element.find(this.component):!1,this.component&&this.component.length===0&&(this.component=!1),this.container=this.options.container===!0?this.element:this.options.container,this.container=this.container!==!1?n(this.container):!1,this.input=this.element.is("input")?this.element:this.options.input?this.element.find(this.options.input):!1,this.input&&this.input.length===0&&(this.input=!1),this.color=new t(this.options.color!==!1?this.options.color:this.getValue(),this.options.colorSelectors),this.format=this.options.format!==!1?this.options.format:this.color.origFormat,this.picker=n(this.options.template),this.options.customClass&&this.picker.addClass(this.options.customClass),this.options.inline?this.picker.addClass("colorpicker-inline colorpicker-visible"):this.picker.addClass("colorpicker-hidden"),this.options.horizontal&&this.picker.addClass("colorpicker-horizontal"),(this.format==="rgba"||this.format==="hsla"||this.options.format===!1)&&this.picker.addClass("colorpicker-with-alpha"),this.options.align==="right"&&this.picker.addClass("colorpicker-right"),this.options.colorSelectors){var f=this;n.each(this.options.colorSelectors,function(t,i){var r=n("<i />").css("background-color",i).data("class",t);r.click(function(){f.setValue(n(this).css("background-color"))});f.picker.find(".colorpicker-selectors").append(r)});this.picker.find(".colorpicker-selectors").show()}this.picker.on("mousedown.colorpicker touchstart.colorpicker",n.proxy(this.mousedown,this));if(this.picker.appendTo(this.container?this.container:n("body")),this.input!==!1){this.input.on({"keyup.colorpicker":n.proxy(this.keyup,this)});this.input.on({"change.colorpicker":n.proxy(this.change,this)});if(this.component===!1)this.element.on({"focus.colorpicker":n.proxy(this.show,this)});if(this.options.inline===!1)this.element.on({"focusout.colorpicker":n.proxy(this.hide,this)})}if(this.component!==!1)this.component.on({"click.colorpicker":n.proxy(this.show,this)});if(this.input===!1&&this.component===!1)this.element.on({"click.colorpicker":n.proxy(this.show,this)});if(this.input!==!1&&this.component!==!1&&this.input.attr("type")==="color")this.input.on({"click.colorpicker":n.proxy(this.show,this),"focus.colorpicker":n.proxy(this.show,this)});this.update();n(n.proxy(function(){this.element.trigger("create")},this))};i.Color=t;i.prototype={constructor:i,destroy:function(){this.picker.remove();this.element.removeData("colorpicker").off(".colorpicker");this.input!==!1&&this.input.off(".colorpicker");this.component!==!1&&this.component.off(".colorpicker");this.element.removeClass("colorpicker-element");this.element.trigger({type:"destroy"})},reposition:function(){if(this.options.inline!==!1||this.options.container)return!1;var i=this.container&&this.container[0]!==document.body?"position":"offset",n=this.component||this.element,t=n[i]();this.options.align==="right"&&(t.left-=this.picker.outerWidth()-n.outerWidth());this.picker.css({top:t.top+n.outerHeight(),left:t.left})},show:function(t){if(this.isDisabled())return!1;this.picker.addClass("colorpicker-visible").removeClass("colorpicker-hidden");this.reposition();n(window).on("resize.colorpicker",n.proxy(this.reposition,this));if(t&&(!this.hasInput()||this.input.attr("type")==="color")&&t.stopPropagation&&t.preventDefault&&(t.stopPropagation(),t.preventDefault()),this.options.inline===!1)n(window.document).on({"mousedown.colorpicker":n.proxy(this.hide,this)});this.element.trigger({type:"showPicker",color:this.color})},hide:function(){this.picker.addClass("colorpicker-hidden").removeClass("colorpicker-visible");n(window).off("resize.colorpicker",this.reposition);n(document).off({"mousedown.colorpicker":this.hide});this.update();this.element.trigger({type:"hidePicker",color:this.color})},updateData:function(n){return n=n||this.color.toString(this.format),this.element.data("color",n),n},updateInput:function(n){if(n=n||this.color.toString(this.format),this.input!==!1){if(this.options.colorSelectors){var r=new t(n,this.options.colorSelectors),i=r.toAlias();typeof this.options.colorSelectors[i]!="undefined"&&(n=i)}this.input.prop("value",n)}return n},updatePicker:function(n){n!==undefined&&(this.color=new t(n,this.options.colorSelectors));var i=this.options.horizontal===!1?this.options.sliders:this.options.slidersHorz,r=this.picker.find("i");if(r.length!==0)return this.options.horizontal===!1?(i=this.options.sliders,r.eq(1).css("top",i.hue.maxTop*(1-this.color.value.h)).end().eq(2).css("top",i.alpha.maxTop*(1-this.color.value.a))):(i=this.options.slidersHorz,r.eq(1).css("left",i.hue.maxLeft*(1-this.color.value.h)).end().eq(2).css("left",i.alpha.maxLeft*(1-this.color.value.a))),r.eq(0).css({top:i.saturation.maxTop-this.color.value.b*i.saturation.maxTop,left:this.color.value.s*i.saturation.maxLeft}),this.picker.find(".colorpicker-saturation").css("backgroundColor",this.color.toHex(this.color.value.h,1,1,1)),this.picker.find(".colorpicker-alpha").css("backgroundColor",this.color.toHex()),this.picker.find(".colorpicker-color, .colorpicker-color div").css("backgroundColor",this.color.toString(this.format)),n},updateComponent:function(n){if(n=n||this.color.toString(this.format),this.component!==!1){var t=this.component.find("i").eq(0);t.length>0?t.css({backgroundColor:n}):this.component.css({backgroundColor:n})}return n},update:function(n){var t;return(this.getValue(!1)!==!1||n===!0)&&(t=this.updateComponent(),this.updateInput(t),this.updateData(t),this.updatePicker()),t},setValue:function(n){this.color=new t(n,this.options.colorSelectors);this.update(!0);this.element.trigger({type:"changeColor",color:this.color,value:n})},getValue:function(n){n=n===undefined?"#000000":n;var t;return t=this.hasInput()?this.input.val():this.element.data("color"),(t===undefined||t===""||t===null)&&(t=n),t},hasInput:function(){return this.input!==!1},isDisabled:function(){return this.hasInput()?this.input.prop("disabled")===!0:!1},disable:function(){return this.hasInput()?(this.input.prop("disabled",!0),this.element.trigger({type:"disable",color:this.color,value:this.getValue()}),!0):!1},enable:function(){return this.hasInput()?(this.input.prop("disabled",!1),this.element.trigger({type:"enable",color:this.color,value:this.getValue()}),!0):!1},currentSlider:null,mousePointer:{left:0,top:0},mousedown:function(t){var u;t.pageX||t.pageY||!t.originalEvent||(t.pageX=t.originalEvent.touches[0].pageX,t.pageY=t.originalEvent.touches[0].pageY);t.stopPropagation();t.preventDefault();var f=n(t.target),i=f.closest("div"),r=this.options.horizontal?this.options.slidersHorz:this.options.sliders;if(!i.is(".colorpicker")){if(i.is(".colorpicker-saturation"))this.currentSlider=n.extend({},r.saturation);else if(i.is(".colorpicker-hue"))this.currentSlider=n.extend({},r.hue);else if(i.is(".colorpicker-alpha"))this.currentSlider=n.extend({},r.alpha);else return!1;u=i.offset();this.currentSlider.guide=i.find("i")[0].style;this.currentSlider.left=t.pageX-u.left;this.currentSlider.top=t.pageY-u.top;this.mousePointer={left:t.pageX,top:t.pageY};n(document).on({"mousemove.colorpicker":n.proxy(this.mousemove,this),"touchmove.colorpicker":n.proxy(this.mousemove,this),"mouseup.colorpicker":n.proxy(this.mouseup,this),"touchend.colorpicker":n.proxy(this.mouseup,this)}).trigger("mousemove")}return!1},mousemove:function(n){n.pageX||n.pageY||!n.originalEvent||(n.pageX=n.originalEvent.touches[0].pageX,n.pageY=n.originalEvent.touches[0].pageY);n.stopPropagation();n.preventDefault();var t=Math.max(0,Math.min(this.currentSlider.maxLeft,this.currentSlider.left+((n.pageX||this.mousePointer.left)-this.mousePointer.left))),i=Math.max(0,Math.min(this.currentSlider.maxTop,this.currentSlider.top+((n.pageY||this.mousePointer.top)-this.mousePointer.top)));return this.currentSlider.guide.left=t+"px",this.currentSlider.guide.top=i+"px",this.currentSlider.callLeft&&this.color[this.currentSlider.callLeft].call(this.color,t/this.currentSlider.maxLeft),this.currentSlider.callTop&&this.color[this.currentSlider.callTop].call(this.color,i/this.currentSlider.maxTop),this.currentSlider.callTop==="setAlpha"&&this.options.format===!1&&(this.color.value.a!==1?(this.format="rgba",this.color.origFormat="rgba"):(this.format="hex",this.color.origFormat="hex")),this.update(!0),this.element.trigger({type:"changeColor",color:this.color}),!1},mouseup:function(t){return t.stopPropagation(),t.preventDefault(),n(document).off({"mousemove.colorpicker":this.mousemove,"touchmove.colorpicker":this.mousemove,"mouseup.colorpicker":this.mouseup,"touchend.colorpicker":this.mouseup}),!1},change:function(n){this.keyup(n)},keyup:function(n){n.keyCode===38?(this.color.value.a<1&&(this.color.value.a=Math.round((this.color.value.a+.01)*100)/100),this.update(!0)):n.keyCode===40?(this.color.value.a>0&&(this.color.value.a=Math.round((this.color.value.a-.01)*100)/100),this.update(!0)):(this.color=new t(this.input.val(),this.options.colorSelectors),this.color.origFormat&&this.options.format===!1&&(this.format=this.color.origFormat),this.getValue(!1)!==!1&&(this.updateData(),this.updateComponent(),this.updatePicker()));this.element.trigger({type:"changeColor",color:this.color,value:this.input.val()})}};n.colorpicker=i;n.fn.colorpicker=function(t){var u=arguments,r,f=this.each(function(){var e=n(this),f=e.data("colorpicker"),o=typeof t=="object"?t:{};f||typeof t=="string"?typeof t=="string"&&(r=f[t].apply(f,Array.prototype.slice.call(u,1))):e.data("colorpicker",new i(this,o))});return t==="getValue"?r:f};n.fn.colorpicker.constructor=i});!function(n,t){function u(t){return n.less[t.split("/")[1]]}function e(n,t){"undefined"!=typeof console&&i.logLevel>=t&&console.log("less: "+n)}function y(n){return n.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function it(n,i){var s="{line} {content}",h=n.filename||i,o=[],r=(n.type||"Syntax")+"Error: "+(n.message||"There is an error in your .less file")+" in "+h+" ",u=function(n,i,r){n.extract[i]!==t&&o.push(s.replace(/\{line\}/,(parseInt(n.line,10)||0)+(i-1)).replace(/\{class\}/,r).replace(/\{content\}/,n.extract[i]))};n.extract?(u(n,0,""),u(n,1,"line"),u(n,2,""),r+="on line "+n.line+", column "+(n.column+1)+":\n"+o.join("\n")):n.stack&&(r+=n.stack);e(r,f.errors)}function l(n,t,i){var s=t.href||"",l="less:"+(t.title||y(s)),u=document.getElementById(l),c=!1,r=document.createElement("style"),a,h;if(r.setAttribute("type","text/css"),t.media&&r.setAttribute("media",t.media),r.id=l,r.styleSheet)try{r.styleSheet.cssText=n}catch(v){throw new Error("Couldn't reassign styleSheet.cssText.");}else r.appendChild(document.createTextNode(n)),c=null!==u&&u.childNodes.length>0&&r.childNodes.length>0&&u.firstChild.nodeValue===r.firstChild.nodeValue;if(a=document.getElementsByTagName("head")[0],(null===u||c===!1)&&(h=t&&t.nextSibling||null,h?h.parentNode.insertBefore(r,h):a.appendChild(r)),u&&c===!1&&u.parentNode.removeChild(u),i&&o){e("saving "+s+" to cache.",f.info);try{o.setItem(s,n);o.setItem(s+":timestamp",i)}catch(v){e("failed to save",f.errors)}}}function k(n){return i.postProcessor&&"function"==typeof i.postProcessor&&(n=i.postProcessor.call(n,n)||n),n}function rt(n,r){var s,f,o="less-error-message:"+y(r||""),a='<li><label>{line}<\/label><pre class="{class}">{content}<\/pre><\/li>',u=document.createElement("div"),h=[],c=n.filename||r,v=c.match(/([^\/]+(\?.*)?)$/)[1],e;u.id=o;u.className="less-error-message";f="<h3>"+(n.type||"Syntax")+"Error: "+(n.message||"There is an error in your .less file")+'<\/h3><p>in <a href="'+c+'">'+v+"<\/a> ";e=function(n,i,r){n.extract[i]!==t&&h.push(a.replace(/\{line\}/,(parseInt(n.line,10)||0)+(i-1)).replace(/\{class\}/,r).replace(/\{content\}/,n.extract[i]))};n.extract?(e(n,0,""),e(n,1,"line"),e(n,2,""),f+="on line "+n.line+", column "+(n.column+1)+":<\/p><ul>"+h.join("")+"<\/ul>"):n.stack&&(f+="<br/>"+n.stack.split("\n").slice(1).join("<br/>"));u.innerHTML=f;l(".less-error-message ul, .less-error-message li {\nlist-style-type: none;\nmargin-right: 15px;\npadding: 4px 0;\nmargin: 0;\n}\n.less-error-message label {\nfont-size: 12px;\nmargin-right: 15px;\npadding: 4px 0;\ncolor: #cc7777;\n}\n.less-error-message pre {\ncolor: #dd6666;\npadding: 4px 0;\nmargin: 0;\ndisplay: inline-block;\n}\n.less-error-message pre.line {\ncolor: #ff0000;\n}\n.less-error-message h3 {\nfont-size: 20px;\nfont-weight: bold;\npadding: 15px 0 5px 0;\nmargin: 0;\n}\n.less-error-message a {\ncolor: #10a\n}\n.less-error-message .error {\ncolor: red;\nfont-weight: bold;\npadding-bottom: 2px;\nborder-bottom: 1px dashed red;\n}",{title:"error-message"});u.style.cssText="font-family: Arial, sans-serif;border: 1px solid #e00;background-color: #eee;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-radius: 5px;color: #e00;padding: 15px;margin-bottom: 15px";"development"==i.env&&(s=setInterval(function(){document.body&&(document.getElementById(o)?document.body.replaceChild(u,document.getElementById(o)):document.body.insertBefore(u,document.body.firstChild),clearInterval(s))},10))}function p(n,t){i.errorReporting&&"html"!==i.errorReporting?"console"===i.errorReporting?it(n,t):"function"==typeof i.errorReporting&&i.errorReporting("add",n,t):rt(n,t)}function ut(n){var t=document.getElementById("less-error-message:"+y(n));t&&t.parentNode.removeChild(t)}function ft(){}function et(n){i.errorReporting&&"html"!==i.errorReporting?"console"===i.errorReporting?ft(n):"function"==typeof i.errorReporting&&i.errorReporting("remove",n):ut(n)}function d(n){for(var t,u,e,o,f=document.getElementsByTagName("style"),r=0;r<f.length;r++)(t=f[r],t.type.match(tt))&&(u=new i.tree.parseEnv(i),e=t.innerHTML||"",u.filename=document.location.href.replace(/#.*$/,""),(n||i.globalVars)&&(u.useFileCache=!0),o=function(n){return function(t,r){if(t)return p(t,"inline");var u=r.toCSS(i);n.type="text/css";n.styleSheet?n.styleSheet.cssText=u:n.innerHTML=u}}(t),new i.Parser(u).parse(e,o,{globalVars:i.globalVars,modifyVars:n}))}function a(n,t){var r,e,o=/^((?:[a-z-]+:)?\/+?(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i,i=n.match(o),f={},u=[];if(!i)throw new Error("Could not parse sheet href - '"+n+"'");if(!i[1]||i[2]){if(e=t.match(o),!e)throw new Error("Could not parse page url - '"+t+"'");i[1]=i[1]||e[1]||"";i[2]||(i[3]=e[3]+i[3])}if(i[3]){for(u=i[3].replace(/\\/g,"/").split("/"),r=0;r<u.length;r++)"."===u[r]&&(u.splice(r,1),r-=1);for(r=0;r<u.length;r++)".."===u[r]&&r>0&&(u.splice(r-1,2),r-=2)}return f.hostPart=i[1],f.directories=u,f.path=i[1]+u.join("/"),f.fileUrl=f.path+(i[4]||""),f.url=f.fileUrl+(i[5]||""),f}function ot(n,t){var i,o,f,s,r=a(n),u=a(t),e="";if(r.hostPart!==u.hostPart)return"";for(o=Math.max(u.directories.length,r.directories.length),i=0;o>i&&u.directories[i]===r.directories[i];i++);for(s=u.directories.slice(i),f=r.directories.slice(i),i=0;i<s.length-1;i++)e+="../";for(i=0;i<f.length-1;i++)e+=f[i]+"/";return e}function st(){if(n.XMLHttpRequest&&("file:"!==n.location.protocol||!n.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){return e("browser doesn't support AJAX.",f.errors),null}}function ht(n,t,r,u){function s(t,i,r){t.status>=200&&t.status<300?i(t.responseText,t.getResponseHeader("Last-Modified")):"function"==typeof r&&r(t.status,n)}var o=st(),h=c?i.fileAsync:i.async;"function"==typeof o.overrideMimeType&&o.overrideMimeType("text/css");e("XHR: Getting '"+n+"'",f.debug);o.open("GET",n,h);o.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5");o.send(null);c&&!i.fileAsync?0===o.status||o.status>=200&&o.status<300?r(o.responseText):u(o.status,n):h?o.onreadystatechange=function(){4==o.readyState&&s(o,r,u)}:s(o,r,u)}function g(t,r,u,f){var h;r&&r.currentDirectory&&!/^([a-z-]+:)?\//.test(t)&&(t=r.currentDirectory+t);var s=a(t,n.location.href),o=s.url,e={currentDirectory:s.path,filename:o};if(r?(e.entryPath=r.entryPath,e.rootpath=r.rootpath,e.rootFilename=r.rootFilename,e.relativeUrls=r.relativeUrls):(e.entryPath=s.path,e.rootpath=i.rootpath||s.path,e.rootFilename=o,e.relativeUrls=f.relativeUrls),e.relativeUrls&&(e.rootpath=f.rootpath?a(f.rootpath+ot(s.path,e.entryPath)).path:s.path),f.useFileCache&&b[o])try{h=b[o];u(null,h,o,e,{lastModified:new Date})}catch(c){u(c,null,o)}else ht(o,f.mime,function(n,t){b[o]=n;try{u(null,n,o,e,{lastModified:t})}catch(i){u(i,null,o)}},function(n,t){u({type:"File",message:"'"+t+"' wasn't found ("+n+")"},null,o)})}function ct(n,t,r,u,f){var e=new i.tree.parseEnv(i);e.mime=n.type;(f||i.globalVars)&&(e.useFileCache=!0);g(n.href,null,function(s,h,c,a,v){if(v){v.remaining=u;var p=o&&o.getItem(c),y=o&&o.getItem(c+":timestamp");if(!r&&y&&v.lastModified&&new Date(v.lastModified).valueOf()===new Date(y).valueOf())return l(p,n),v.local=!0,void t(null,null,h,n,v,c)}et(c);h?(e.currentFileInfo=a,new i.Parser(e).parse(h,function(i,r){if(i)return t(i,null,null,n);try{t(i,r,h,n,v,c)}catch(i){t(i,null,null,n)}},{modifyVars:f,globalVars:i.globalVars})):t(s,null,null,n,v,c)},e,f)}function nt(n,t,r){for(var u=0;u<i.sheets.length;u++)ct(i.sheets[u],n,t,i.sheets.length-(u+1),r)}function lt(){"development"===i.env?(i.optimization=0,i.watchTimer=setInterval(function(){i.watchMode&&nt(function(n,t,r,u,f){if(n)p(n,u.href);else if(t){var e=t.toCSS(i);e=k(e);l(e,u,f.lastModified)}})},i.poll)):i.optimization=3}var i,r,c,f,v,w,h,s;if(("undefined"==typeof n.less||"undefined"!=typeof n.less.nodeType)&&(n.less={}),i=n.less,r=n.less.tree={},i.mode="browser",i===t&&(i=exports,r=u("./tree"),i.mode="node"),i.Parser=function(n){function w(){a=f;ot.push({current:h,i:f,j:g})}function y(){var n=ot.pop();h=n.current;a=f=n.i;g=n.j}function l(){ot.pop()}function lt(){f>a&&(h=h.slice(f-a),a=f)}function nt(n,t){var i=n.charCodeAt(0|t);return 32>=i&&(32===i||10===i||9===i)}function at(n){var t,i,r=typeof n;return"string"===r?e.charAt(f)!==n?null:(d(1),n):(lt(),(t=n.exec(h))?(i=t[0].length,d(i),"string"==typeof t?t:1===t.length?t[0]:t):null)}function o(n){f>a&&(h=h.slice(f-a),a=f);var t=n.exec(h);return t?(d(t[0].length),"string"==typeof t?t:1===t.length?t[0]:t):null}function s(n){return e.charAt(f)!==n?null:(d(1),n)}function d(n){for(var t,r=f,u=g,i=f-a,o=f+h.length-i,s=f+=n,c=e;o>f&&(t=c.charCodeAt(f),!(t>32))&&(32===t||10===t||9===t||13===t);f++);return h=h.slice(n+f-s+i),a=f,!h.length&&g<ft.length-1?(h=ft[++g],d(0),!0):r!==f||u!==g}function tt(n,t){var i="[object Function]"===Object.prototype.toString.call(n)?n.call(v):at(n);return i?i:void c(t||("string"==typeof n?"expected '"+n+"' got '"+e.charAt(f)+"'":"unexpected token"))}function b(n,t){return e.charAt(f)===n?(d(1),n):void c(t||"expected '"+n+"' got '"+e.charAt(f)+"'")}function c(n,t){var i=new Error(n);throw i.index=f,i.type=t||"Syntax",i;}function rt(n){return"string"==typeof n?e.charAt(f)===n:n.test(h)}function ht(n){return e.charAt(f)===n}function vt(n,t){return n.filename&&t.currentFileInfo.filename&&n.filename!==t.currentFileInfo.filename?k.imports.contents[n.filename]:e}function ut(n,t){for(var i=n+1,r=null,u=-1;--i>=0&&"\n"!==t.charAt(i);)u++;return"number"==typeof n&&(r=(t.slice(0,n).match(/\n/g)||"").length),{line:r,column:u}}function et(n,t,r){var f=r.currentFileInfo.filename;return"browser"!==i.mode&&"rhino"!==i.mode&&(f=u("path").resolve(f)),{lineNumber:ut(n,t).line+1,fileName:f}}function p(n,t){var u=vt(n,t),f=ut(n.index,u),i=f.line,o=f.column,e=n.call&&ut(n.call,u).line,r=u.split("\n");this.type=n.type||"Syntax";this.message=n.message;this.filename=n.filename||t.currentFileInfo.filename;this.index=n.index;this.line="number"==typeof i?i+1:null;this.callLine=e+1;this.callExtract=r[e];this.stack=n.stack;this.column=o;this.extract=[r[i-1],r[i],r[i+1]]}var e,f,g,it,ft,h,a,k,v,ot=[],yt=n&&n.filename,ct,st;return n instanceof r.parseEnv||(n=new r.parseEnv(n)),ct=this.imports={paths:n.paths||[],queue:[],files:n.files,contents:n.contents,contentsIgnoredChars:n.contentsIgnoredChars,mime:n.mime,error:null,push:function(t,u,f,e){var o=this,s;this.queue.push(t);s=function(n,i,r){o.queue.splice(o.queue.indexOf(t),1);var u=r===yt;o.files[r]=i;n&&!o.error&&(o.error=n);e(n,i,u,r)};i.Parser.importer?i.Parser.importer(t,u,s,n):i.Parser.fileLoader(t,u,function(t,e,o,h){if(t)return void s(t);var c=new r.parseEnv(n);c.currentFileInfo=h;c.processImports=!1;c.contents[o]=e;(u.reference||f.reference)&&(h.reference=!0);f.inline?s(null,e,o):new i.Parser(c).parse(e,function(n,t){s(n,t,o)})},n)}},st=o,p.prototype=new Error,p.prototype.constructor=p,this.env=n=n||{},this.optimization="optimization"in this.env?this.env.optimization:1,k={imports:ct,parse:function(o,s,c){var l,v,w,b,rt,y=null,d="",nt,tt;if(f=g=a=it=0,b=c&&c.globalVars?i.Parser.serializeVars(c.globalVars)+"\n":"",rt=c&&c.modifyVars?"\n"+i.Parser.serializeVars(c.modifyVars):"",(b||c&&c.banner)&&(d=(c&&c.banner?c.banner:"")+b,k.imports.contentsIgnoredChars[n.currentFileInfo.filename]=d.length),o=o.replace(/\r\n/g,"\n"),e=o=d+o.replace(/^\uFEFF/,"")+rt,k.imports.contents[n.currentFileInfo.filename]=o,ft=function(t){function u(t,r){y=new p({index:r||i,type:"Parse",message:t,filename:n.currentFileInfo.filename},n)}function l(n){var r=i-w;512>r&&!n||!r||(d.push(t.slice(w,i+1)),w=i+1)}for(var s,b,a,k,h,e,r,v,f=t.length,c=0,o=0,d=[],w=0,i=0;f>i;i++)if(e=t.charCodeAt(i),!(e>=97&&122>=e||34>e))switch(e){case 40:o++;b=i;continue;case 41:if(--o<0)return u("missing opening `(`");continue;case 59:o||l();continue;case 123:c++;s=i;continue;case 125:if(--c<0)return u("missing opening `{`");c||o||l();continue;case 92:if(f-1>i){i++;continue}return u("unescaped `\\`");case 34:case 39:case 96:for(v=0,h=i,i+=1;f>i;i++)if(r=t.charCodeAt(i),!(r>96)){if(r==e){v=1;break}if(92==r){if(i==f-1)return u("unescaped `\\`");i++}}if(v)continue;return u("unmatched `"+String.fromCharCode(e)+"`",h);case 47:if(o||i==f-1)continue;if(r=t.charCodeAt(i+1),47==r)for(i+=2;f>i&&(r=t.charCodeAt(i),!(13>=r)||10!=r&&13!=r);i++);else if(42==r){for(a=h=i,i+=2;f-1>i&&(r=t.charCodeAt(i),125==r&&(k=i),42!=r||47!=t.charCodeAt(i+1));i++);if(i==f-1)return u("missing closing `*/`",h);i++}continue;case 42:if(f-1>i&&47==t.charCodeAt(i+1))return u("unmatched `/*`");continue}return 0!==c?a>s&&k>a?u("missing closing `}` or `*/`",s):u("missing closing `}`",s):0!==o?u("missing closing `)`",b):(l(!0),d)}(o),y)return s(new p(y,n));h=ft[0];try{l=new r.Ruleset(null,this.parsers.primary());l.root=!0;l.firstRoot=!0}catch(et){return s(new p(et,n))}return(l.toCSS=function(f){return function(e,o){var c,l,v,b,h;e=e||{};v=new r.evalEnv(e);"object"!=typeof o||Array.isArray(o)||(o=Object.keys(o).map(function(n){var t=o[n];return t instanceof r.Value||(t instanceof r.Expression||(t=new r.Expression([t])),t=new r.Value([t])),new r.Rule("@"+n,t,!1,null,0)}),v.frames=[new r.Ruleset(null,o)]);try{var s,y=[],a=[new r.joinSelectorVisitor,new r.processExtendsVisitor,new r.toCSSVisitor({compress:Boolean(e.compress)})],w=this;if(e.plugins)for(s=0;s<e.plugins.length;s++)e.plugins[s].isPreEvalVisitor?y.push(e.plugins[s]):e.plugins[s].isPreVisitor?a.splice(0,0,e.plugins[s]):a.push(e.plugins[s]);for(s=0;s<y.length;s++)y[s].run(w);for(c=f.call(w,v),s=0;s<a.length;s++)a[s].run(c);e.sourceMap&&(c=new r.sourceMapOutput({contentsIgnoredCharsMap:k.imports.contentsIgnoredChars,writeSourceMap:e.writeSourceMap,rootNode:c,contentsMap:k.imports.contents,sourceMapFilename:e.sourceMapFilename,sourceMapURL:e.sourceMapURL,outputFilename:e.sourceMapOutputFilename,sourceMapBasepath:e.sourceMapBasepath,sourceMapRootpath:e.sourceMapRootpath,outputSourceFiles:e.outputSourceFiles,sourceMapGenerator:e.sourceMapGenerator}));l=c.toCSS({compress:Boolean(e.compress),dumpLineNumbers:n.dumpLineNumbers,strictUnits:Boolean(e.strictUnits),numPrecision:8})}catch(d){throw new p(d,n);}return e.cleancss&&"node"===i.mode?(b=u("clean-css"),h=e.cleancssOptions||{},h.keepSpecialComments===t&&(h.keepSpecialComments="*"),h.processImport=!1,h.noRebase=!0,h.noAdvanced===t&&(h.noAdvanced=!0),new b(h).minify(l)):e.compress?l.replace(/(^(\s)+)|((\s)+$)/g,""):l}}(l.eval),f<e.length-1)&&(f=it,nt=ut(f,e),w=e.split("\n"),v=nt.line+1,y={type:"Parse",message:"Unrecognised input",index:f,filename:n.currentFileInfo.filename,line:v,column:nt.column,extract:[w[v-2],w[v-1],w[v]]}),tt=function(t){return t=y||t||k.imports.error,t?(t instanceof p||(t=new p(t,n)),s(t)):s(null,l)},n.processImports===!1?tt():void new r.importVisitor(this.imports,tt).run(l)},parsers:v={primary:function(){for(var n,t=this.mixin,i=st,r=[];h;){if(n=this.extendRule()||t.definition()||this.rule()||this.ruleset()||t.call()||this.comment()||this.rulesetCall()||this.directive())r.push(n);else if(!i(/^[\s\n]+/)&&!i(/^;+/))break;if(ht("}"))break}return r},comment:function(){var t;if("/"===e.charAt(f))return"/"===e.charAt(f+1)?new r.Comment(o(/^\/\/.*/),!0,f,n.currentFileInfo):(t=o(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/),t?new r.Comment(t,!1,f,n.currentFileInfo):void 0)},comments:function(){for(var n,t=[];;){if(n=this.comment(),!n)break;t.push(n)}return t},entities:{quoted:function(){var t,u,i=f,h=f;return"~"===e.charAt(i)&&(i++,u=!0),'"'===e.charAt(i)||"'"===e.charAt(i)?(u&&s("~"),t=o(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/),t?new r.Quoted(t[0],t[1]||t[2],u,h,n.currentFileInfo):void 0):void 0},keyword:function(){var n,t;if(n=o(/^%|^[_A-Za-z-][_A-Za-z0-9-]*/))return t=r.Color.fromKeyword(n),t?t:new r.Keyword(n)},call:function(){var t,i,e,u,o=f;if(t=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(h)){if(t=t[1],i=t.toLowerCase(),"url"===i)return null;if(f+=t.length,"alpha"===i&&(u=v.alpha(),"undefined"!=typeof u))return u;if(s("("),e=this.arguments(),s(")"))return t?new r.Call(t,e,o,n.currentFileInfo):void 0}},arguments:function(){for(var n,t=[];;){if(n=this.assignment()||v.expression(),!n)break;if(t.push(n),!s(","))break}return t},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var n,t;return n=o(/^\w+(?=\s?=)/i),n&&s("=")?(t=v.entity(),t?new r.Assignment(n,t):void 0):void 0},url:function(){var t;if("u"===e.charAt(f)&&o(/^url\(/))return t=this.quoted()||this.variable()||o(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",b(")"),new r.URL(null!=t.value||t instanceof r.Variable?t:new r.Anonymous(t),n.currentFileInfo)},variable:function(){var t,i=f;if("@"===e.charAt(f)&&(t=o(/^@@?[\w-]+/)))return new r.Variable(t,i,n.currentFileInfo)},variableCurly:function(){var t,i=f;if("@"===e.charAt(f)&&(t=o(/^@\{([\w-]+)\}/)))return new r.Variable("@"+t[1],i,n.currentFileInfo)},color:function(){var n;if("#"===e.charAt(f)&&(n=o(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/)))return new r.Color(n[1])},dimension:function(){var n,t=e.charCodeAt(f);if(!(t>57||43>t||47===t||44==t))return n=o(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/),n?new r.Dimension(n[1],n[2]):void 0},unicodeDescriptor:function(){var n;return n=o(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/),n?new r.UnicodeDescriptor(n[0]):void 0},javascript:function(){var i,u,h=f;return"~"===e.charAt(h)&&(h++,u=!0),"`"===e.charAt(h)?(n.javascriptEnabled===t||n.javascriptEnabled||c("You are using JavaScript, which has been disabled."),u&&s("~"),i=o(/^`([^`]*)`/),i?new r.JavaScript(i[1],f,u):void 0):void 0}},variable:function(){var n;if("@"===e.charAt(f)&&(n=o(/^(@[\w-]+)\s*:/)))return n[1]},rulesetCall:function(){var n;if("@"===e.charAt(f)&&(n=o(/^(@[\w-]+)\s*\(\s*\)\s*;/)))return new r.RulesetCall(n[1])},extend:function(n){var i,e,t,u,h,c=f;if(o(n?/^&:extend\(/:/^:extend\(/)){do{for(t=null,i=null;!(t=o(/^(all)(?=\s*(\)|,))/))&&(e=this.element());)i?i.push(e):i=[e];t=t&&t[1];h=new r.Extend(new r.Selector(i),t,c);u?u.push(h):u=[h]}while(s(","));return tt(/^\)/),n&&tt(/^;/),u}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var h,t,i,u,c,a,p=e.charAt(f),k=!1,d=f;if("."===p||"#"===p){for(w();;){if(h=f,u=o(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!u)break;i=new r.Element(c,u,h,n.currentFileInfo);t?t.push(i):t=[i];c=s(">")}return t&&(s("(")&&(a=this.args(!0).args,b(")")),v.important()&&(k=!0),v.end())?(l(),new r.mixin.Call(t,a,d,n.currentFileInfo,k)):void y()}},args:function(n){var i,tt,b,d,u,t,a=k.parsers,it=a.entities,v={args:null,variadic:!1},p=[],g=[],nt=[],h;for(w();;){if(n)t=a.detachedRuleset()||a.expression();else{if(a.comments(),"."===e.charAt(f)&&o(/^\.{3}/)){v.variadic=!0;s(";")&&!i&&(i=!0);(i?g:nt).push({variadic:!0});break}t=it.variable()||it.literal()||it.keyword()}if(!t)break;if(d=null,t.throwAwayComments&&t.throwAwayComments(),u=t,h=null,n?t.value&&1==t.value.length&&(h=t.value[0]):h=t,h&&h instanceof r.Variable)if(s(":")){if(p.length>0&&(i&&c("Cannot mix ; and , as delimiter types"),tt=!0),u=n&&a.detachedRuleset()||a.expression(),!u){if(!n)return y(),v.args=[],v;c("could not understand value for named argument")}d=b=h.name}else{if(!n&&o(/^\.{3}/)){v.variadic=!0;s(";")&&!i&&(i=!0);(i?g:nt).push({name:t.name,variadic:!0});break}n||(b=d=h.name,u=null)}u&&p.push(u);nt.push({name:d,value:u});s(",")||(s(";")||i)&&(tt&&c("Cannot mix ; and , as delimiter types"),i=!0,p.length>1&&(u=new r.Value(p)),g.push({name:b,value:u}),b=null,p=[],tt=!1)}return l(),v.args=i?g:nt,v},definition:function(){var t,i,u,h,c=[],a=!1,n;if(!("."!==e.charAt(f)&&"#"!==e.charAt(f)||rt(/^[^{]*\}/)))if(w(),i=o(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){if(t=i[1],n=this.args(!1),c=n.args,a=n.variadic,!s(")"))return it=f,void y();if(v.comments(),o(/^when/)&&(h=tt(v.conditions,"expected condition")),u=v.block())return l(),new r.mixin.Definition(t,c,u,h,a);y()}else l()}},entity:function(){var n=this.entities;return n.literal()||n.variable()||n.url()||n.call()||n.keyword()||n.javascript()||this.comment()},end:function(){return s(";")||ht("}")},alpha:function(){var n;if(o(/^\(opacity=/i))return n=o(/^\d+/)||this.entities.variable(),n?(b(")"),new r.Alpha(n)):void 0},element:function(){var t,i,u,e=f;return i=this.combinator(),t=o(/^(?:\d+\.\d+|\d+)%/)||o(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||s("*")||s("&")||this.attribute()||o(/^\([^()@]+\)/)||o(/^[\.#](?=@)/)||this.entities.variableCurly(),t||(w(),s("(")?(u=this.selector())&&s(")")?(t=new r.Paren(u),l()):y():l()),t?new r.Element(i,t,e,n.currentFileInfo):void 0},combinator:function(){var n=e.charAt(f);if(">"===n||"+"===n||"~"===n||"|"===n||"^"===n){for(f++,"^"===e.charAt(f)&&(n="^^",f++);nt(e,f);)f++;return new r.Combinator(n)}return new r.Combinator(nt(e,f-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(t){for(var o,i,u,s,h,a,l,v=f,y=st;(t&&(h=this.extend())||t&&(a=y(/^when/))||(s=this.element()))&&(a?l=tt(this.conditions,"expected condition"):l?c("CSS guard can only be used at the end of selector"):h?i?i.push(h):i=[h]:(i&&c("Extend can only be used at the end of selector"),u=e.charAt(f),o?o.push(s):o=[s],s=null),"{"!==u&&"}"!==u&&";"!==u&&","!==u&&")"!==u););return o?new r.Selector(o,i,l,v,n.currentFileInfo):void(i&&c("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(s("[")){var n,u,t,i=this.entities;return(n=i.variableCurly())||(n=tt(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),t=o(/^[|~*$^]?=/),t&&(u=i.quoted()||o(/^[0-9]+%/)||o(/^[\w-]+/)||i.variableCurly()),b("]"),new r.Attribute(n,t,u)}},block:function(){var n;if(s("{")&&(n=this.primary())&&s("}"))return n},blockRuleset:function(){var n=this.block();return n&&(n=new r.Ruleset(null,n)),n},detachedRuleset:function(){var n=this.blockRuleset();if(n)return new r.DetachedRuleset(n)},ruleset:function(){var t,i,o,h,u;for(w(),n.dumpLineNumbers&&(h=et(f,e,n));;){if(i=this.lessSelector(),!i)break;if(t?t.push(i):t=[i],this.comments(),i.condition&&t.length>1&&c("Guards are only currently allowed on a single selector."),!s(","))break;i.condition&&c("Guards are only currently allowed on a single selector.");this.comments()}if(t&&(o=this.block()))return l(),u=new r.Ruleset(t,o,n.strictImports),n.dumpLineNumbers&&(u.debugInfo=h),u;it=f;y()},rule:function(t){var u,i,h,c,o,a=f,s=e.charAt(a);if("."!==s&&"#"!==s&&"&"!==s)if(w(),u=this.variable()||this.ruleProperty()){if(o="string"==typeof u,o&&(i=this.detachedRuleset()),i||(i=t||!n.compress&&!o?this.anonymousValue()||this.value():this.value()||this.anonymousValue(),h=this.important(),c=!o&&u.pop().value),i&&this.end())return l(),new r.Rule(u,i,h,c,a,n.currentFileInfo);if(it=f,y(),i&&!t)return this.rule(!0)}else l()},anonymousValue:function(){var n;return n=/^([^@+\/'"*`(;{}-]*);/.exec(h),n?(f+=n[0].length-1,new r.Anonymous(n[1])):void 0},"import":function(){var u,t,h=f,i,e;return w(),i=o(/^@import?\s+/),e=(i?this.importOptions():null)||{},i&&(u=this.entities.quoted()||this.entities.url())&&(t=this.mediaFeatures(),s(";"))?(l(),t=t&&new r.Value(t),new r.Import(u,t,e,h,n.currentFileInfo)):void y()},importOptions:function(){var i,n,t,r={};if(!s("("))return null;do if(i=this.importOption()){switch(n=i,t=!0,n){case"css":n="less";t=!1;break;case"once":n="multiple";t=!1}if(r[n]=t,!s(","))break}while(i);return b(")"),r},importOption:function(){var n=o(/^(less|css|multiple|once|inline|reference)/);if(n)return n[1]},mediaFeature:function(){var t,u,e=this.entities,i=[];do if(t=e.keyword()||e.variable())i.push(t);else if(s("(")){if(u=this.property(),t=this.value(),!s(")"))return null;if(u&&t)i.push(new r.Paren(new r.Rule(u,t,null,null,f,n.currentFileInfo,!0)));else{if(!t)return null;i.push(new r.Paren(t))}}while(t);if(i.length>0)return new r.Expression(i)},mediaFeatures:function(){var n,i=this.entities,t=[];do if(n=this.mediaFeature()){if(t.push(n),!s(","))break}else if(n=i.variable(),n&&(t.push(n),!s(",")))break;while(n);return t.length>0?t:null},media:function(){var i,u,t,s;return n.dumpLineNumbers&&(s=et(f,e,n)),o(/^@media/)&&(i=this.mediaFeatures(),u=this.block())?(t=new r.Media(u,i,f,n.currentFileInfo),n.dumpLineNumbers&&(t.debugInfo=s),t):void 0},directive:function(){var i,t,h,a,v,p,b,k=f,u=!0;if("@"===e.charAt(f)){if(t=this["import"]()||this.media())return t;if(w(),i=o(/^@[a-z-]+/)){switch(a=i,"-"==i.charAt(1)&&i.indexOf("-",2)>0&&(a="@"+i.slice(i.indexOf("-",2)+1)),a){case"@charset":v=!0;u=!1;break;case"@namespace":p=!0;u=!1;break;case"@keyframes":v=!0;break;case"@host":case"@page":case"@document":case"@supports":b=!0}return v?(t=this.entity(),t||c("expected "+i+" identifier")):p?(t=this.expression(),t||c("expected "+i+" expression")):b&&(t=(o(/^[^{;]+/)||"").trim(),t&&(t=new r.Anonymous(t))),u&&(h=this.blockRuleset()),h||!u&&t&&s(";")?(l(),new r.Directive(i,t,h,k,n.currentFileInfo,n.dumpLineNumbers?et(k,e,n):null)):void y()}}},value:function(){var n,t=[];do if(n=this.expression(),n&&(t.push(n),!s(",")))break;while(n);if(t.length>0)return new r.Value(t)},important:function(){if("!"===e.charAt(f))return o(/^! *important/)},sub:function(){var t,n;if(s("(")&&(t=this.addition()))return(n=new r.Expression([t]),b(")"),n.parens=!0,n)},multiplication:function(){var n,t,i,u,o;if(n=this.operand()){for(o=nt(e,f-1);;){if(rt(/^\/[*\/]/))break;if(i=s("/")||s("*"),!i)break;if(t=this.operand(),!t)break;n.parensInOp=!0;t.parensInOp=!0;u=new r.Operation(i,[u||n,t],o);o=nt(e,f-1)}return u||n}},addition:function(){var n,t,u,h,i;if(n=this.multiplication()){for(i=nt(e,f-1);;){if(u=o(/^[-+]\s+/)||!i&&(s("+")||s("-")),!u)break;if(t=this.multiplication(),!t)break;n.parensInOp=!0;t.parensInOp=!0;h=new r.Operation(u,[h||n,t],i);i=nt(e,f-1)}return h||n}},conditions:function(){var n,t,i,u=f;if(n=this.condition()){for(;;){if(!rt(/^,\s*(not\s*)?\(/)||!s(","))break;if(t=this.condition(),!t)break;i=new r.Condition("or",i||n,t,u)}return i||n}},condition:function(){var n,u,t,e,i=this.entities,h=f,s=!1;return o(/^not/)&&(s=!0),b("("),n=this.addition()||i.keyword()||i.quoted(),n?(e=o(/^(?:>=|<=|=<|[<=>])/),e?(u=this.addition()||i.keyword()||i.quoted(),u?t=new r.Condition(e,n,u,h,s):c("expected expression")):t=new r.Condition("=",n,new r.Keyword("true"),h,s),b(")"),o(/^and/)?new r.Condition("and",t,this.condition()):t):void 0},operand:function(){var i,t=this.entities,u=e.charAt(f+1),n;return"-"!==e.charAt(f)||"@"!==u&&"("!==u||(i=s("-")),n=this.sub()||t.dimension()||t.color()||t.variable()||t.call(),i&&(n.parensInOp=!0,n=new r.Negative(n)),n},expression:function(){var n,i,t=[];do n=this.addition()||this.entity(),n&&(t.push(n),rt(/^\/[\/*]/)||(i=s("/"),i&&t.push(new r.Anonymous(i))));while(n);if(t.length>0)return new r.Expression(t)},property:function(){var n=o(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(n)return n[1]},ruleProperty:function(){function e(n){var i=n.exec(o);if(i)return(s.push(f+c),c+=i[0].length,o=o.slice(i[1].length),t.push(i[1]))}var u,i,o=h,t=[],s=[],c=0;for(e(/^(\*?)/);e(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/););if(t.length>1&&e(/^\s*((?:\+_|\+)?)\s*:/)){for(d(c),""===t[0]&&(t.shift(),s.shift()),i=0;i<t.length;i++)u=t[i],t[i]="@"!==u.charAt(0)?new r.Keyword(u):new r.Variable("@"+u.slice(2,-1),s[i],n.currentFileInfo);return t}}}}},i.Parser.serializeVars=function(n){var r="",t,i;for(t in n)Object.hasOwnProperty.call(n,t)&&(i=n[t],r+=("@"===t[0]?"":"@")+t+": "+i+(";"===(""+i).slice(-1)?"":";"));return r},function(i){function h(n,t,r){if(!(r instanceof i.Dimension))throw{type:"Argument",message:"argument must be a number"};return null==t?t=r.unit:r=r.unify(),new i.Dimension(n(parseFloat(r.value)),t)}function c(n,t,r){for(var f,e,s,c=t.alpha,h=r.alpha,l=[],o=h+c*(1-h),u=0;3>u;u++)f=t.rgb[u]/255,e=r.rgb[u]/255,s=n(f,e),o&&(s=(h*e+c*(f-h*(f+e-s)))/o),l[u]=255*s;return new i.Color(l,o)}function l(){var n,t=i.functions;for(n in s)s.hasOwnProperty(n)&&(t[n]=h.bind(null,Math[n],s[n]));for(n in o)o.hasOwnProperty(n)&&(t[n]=c.bind(null,o[n]));n=i.defaultFunc;t["default"]=n.eval.bind(n)}function e(n){return i.functions.hsla(n.h,n.s,n.l,n.a)}function a(n,t){return n instanceof i.Dimension&&n.unit.is("%")?parseFloat(n.value*t/100):r(n)}function r(n){if(n instanceof i.Dimension)return parseFloat(n.unit.is("%")?n.value/100:n.value);if("number"==typeof n)return n;throw{error:"RuntimeError",message:"color functions take numbers as parameters"};}function f(n){return Math.min(1,Math.max(0,n))}i.functions={rgb:function(n,t,i){return this.rgba(n,t,i,1)},rgba:function(n,t,u,f){var e=[n,t,u].map(function(n){return a(n,255)});return f=r(f),new i.Color(e,f)},hsl:function(n,t,i){return this.hsla(n,t,i,1)},hsla:function(n,t,i,u){function s(n){return n=0>n?n+1:n>1?n-1:n,1>6*n?e+(o-e)*n*6:1>2*n?o:2>3*n?e+(o-e)*(2/3-n)*6:e}n=r(n)%360/360;t=f(r(t));i=f(r(i));u=f(r(u));var o=.5>=i?i*(t+1):i+t-i*t,e=2*i-o;return this.rgba(255*s(n+1/3),255*s(n),255*s(n-1/3),u)},hsv:function(n,t,i){return this.hsva(n,t,i,1)},hsva:function(n,t,i,u){var f,s,e,o;return n=r(n)%360*1,t=r(t),i=r(i),u=r(u),f=Math.floor(n/60%6),s=n/60-f,e=[i,i*(1-t),i*(1-s*t),i*(1-(1-s)*t)],o=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],this.rgba(255*e[o[f][0]],255*e[o[f][1]],255*e[o[f][2]],u)},hue:function(n){return new i.Dimension(Math.round(n.toHSL().h))},saturation:function(n){return new i.Dimension(Math.round(100*n.toHSL().s),"%")},lightness:function(n){return new i.Dimension(Math.round(100*n.toHSL().l),"%")},hsvhue:function(n){return new i.Dimension(Math.round(n.toHSV().h))},hsvsaturation:function(n){return new i.Dimension(Math.round(100*n.toHSV().s),"%")},hsvvalue:function(n){return new i.Dimension(Math.round(100*n.toHSV().v),"%")},red:function(n){return new i.Dimension(n.rgb[0])},green:function(n){return new i.Dimension(n.rgb[1])},blue:function(n){return new i.Dimension(n.rgb[2])},alpha:function(n){return new i.Dimension(n.toHSL().a)},luma:function(n){return new i.Dimension(Math.round(n.luma()*n.alpha*100),"%")},luminance:function(n){var t=.2126*n.rgb[0]/255+.7152*n.rgb[1]/255+.0722*n.rgb[2]/255;return new i.Dimension(Math.round(t*n.alpha*100),"%")},saturate:function(n,t){if(!n.rgb)return null;var i=n.toHSL();return i.s+=t.value/100,i.s=f(i.s),e(i)},desaturate:function(n,t){var i=n.toHSL();return i.s-=t.value/100,i.s=f(i.s),e(i)},lighten:function(n,t){var i=n.toHSL();return i.l+=t.value/100,i.l=f(i.l),e(i)},darken:function(n,t){var i=n.toHSL();return i.l-=t.value/100,i.l=f(i.l),e(i)},fadein:function(n,t){var i=n.toHSL();return i.a+=t.value/100,i.a=f(i.a),e(i)},fadeout:function(n,t){var i=n.toHSL();return i.a-=t.value/100,i.a=f(i.a),e(i)},fade:function(n,t){var i=n.toHSL();return i.a=t.value/100,i.a=f(i.a),e(i)},spin:function(n,t){var i=n.toHSL(),r=(i.h+t.value)%360;return i.h=0>r?360+r:r,e(i)},mix:function(n,t,r){r||(r=new i.Dimension(50));var e=r.value/100,u=2*e-1,o=n.toHSL().a-t.toHSL().a,f=((u*o==-1?u:(u+o)/(1+u*o))+1)/2,s=1-f,h=[n.rgb[0]*f+t.rgb[0]*s,n.rgb[1]*f+t.rgb[1]*s,n.rgb[2]*f+t.rgb[2]*s],c=n.alpha*e+t.alpha*(1-e);return new i.Color(h,c)},greyscale:function(n){return this.desaturate(n,new i.Dimension(100))},contrast:function(n,t,i,u){if(!n.rgb)return null;if("undefined"==typeof i&&(i=this.rgba(255,255,255,1)),"undefined"==typeof t&&(t=this.rgba(0,0,0,1)),t.luma()>i.luma()){var f=i;i=t;t=f}return u="undefined"==typeof u?.43:r(u),n.luma()<u?i:t},e:function(n){return new i.Anonymous(n instanceof i.JavaScript?n.evaluated:n)},escape:function(n){return new i.Anonymous(encodeURI(n.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(n,t,r,u){var f=n.value;return f=f.replace(new RegExp(t.value,u?u.value:""),r.value),new i.Quoted(n.quote||"",f,n.escaped)},"%":function(n){for(var u=Array.prototype.slice.call(arguments,1),t=n.value,r=0;r<u.length;r++)t=t.replace(/%[sda]/i,function(n){var t=n.match(/s/i)?u[r].value:u[r].toCSS();return n.match(/[A-Z]$/)?encodeURIComponent(t):t});return t=t.replace(/%%/g,"%"),new i.Quoted(n.quote||"",t,n.escaped)},unit:function(n,t){if(!(n instanceof i.Dimension))throw{type:"Argument",message:"the first argument to unit must be a number"+(n instanceof i.Operation?". Have you forgotten parenthesis?":"")};return t=t?t instanceof i.Keyword?t.value:t.toCSS():"",new i.Dimension(n.value,t)},convert:function(n,t){return n.convertTo(t.value)},round:function(n,t){var i="undefined"==typeof t?0:t.value;return h(function(n){return n.toFixed(i)},null,n)},pi:function(){return new i.Dimension(Math.PI)},mod:function(n,t){return new i.Dimension(n.value%t.value,n.unit)},pow:function(n,t){if("number"==typeof n&&"number"==typeof t)n=new i.Dimension(n),t=new i.Dimension(t);else if(!(n instanceof i.Dimension&&t instanceof i.Dimension))throw{type:"Argument",message:"arguments must be numbers"};return new i.Dimension(Math.pow(n.value,t.value),n.unit)},_minmax:function(n,r){switch(r=Array.prototype.slice.call(r),r.length){case 0:throw{type:"Argument",message:"one or more arguments required"};}for(var c,e,l,v,u,o,s,f=[],a={},h=0;h<r.length;h++)if(e=r[h],e instanceof i.Dimension)if(l=""===e.unit.toString()&&s!==t?new i.Dimension(e.value,s).unify():e.unify(),u=""===l.unit.toString()&&o!==t?o:l.unit.toString(),o=""!==u&&o===t||""!==u&&""===f[0].unify().unit.toString()?u:o,s=""!==u&&s===t?e.unit.toString():s,c=a[""]!==t&&""!==u&&u===o?a[""]:a[u],c!==t)v=""===f[c].unit.toString()&&s!==t?new i.Dimension(f[c].value,s).unify():f[c].unify(),(n&&l.value<v.value||!n&&l.value>v.value)&&(f[c]=e);else{if(o!==t&&u!==o)throw{type:"Argument",message:"incompatible types"};a[u]=f.length;f.push(e)}else Array.isArray(r[h].value)&&Array.prototype.push.apply(r,Array.prototype.slice.call(r[h].value));return 1==f.length?f[0]:(r=f.map(function(n){return n.toCSS(this.env)}).join(this.env.compress?",":", "),new i.Anonymous((n?"min":"max")+"("+r+")"))},min:function(){return this._minmax(!0,arguments)},max:function(){return this._minmax(!1,arguments)},"get-unit":function(n){return new i.Anonymous(n.unit)},argb:function(n){return new i.Anonymous(n.toARGB())},percentage:function(n){return new i.Dimension(100*n.value,"%")},color:function(n){if(n instanceof i.Quoted){var r,t=n.value;if(r=i.Color.fromKeyword(t))return r;if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.test(t))return new i.Color(t.slice(1));throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"};}throw{type:"Argument",message:"argument must be a string"};},iscolor:function(n){return this._isa(n,i.Color)},isnumber:function(n){return this._isa(n,i.Dimension)},isstring:function(n){return this._isa(n,i.Quoted)},iskeyword:function(n){return this._isa(n,i.Keyword)},isurl:function(n){return this._isa(n,i.URL)},ispixel:function(n){return this.isunit(n,"px")},ispercentage:function(n){return this.isunit(n,"%")},isem:function(n){return this.isunit(n,"em")},isunit:function(n,t){return n instanceof i.Dimension&&n.unit.is(t.value||t)?i.True:i.False},_isa:function(n,t){return n instanceof t?i.True:i.False},tint:function(n,t){return this.mix(this.rgb(255,255,255),n,t)},shade:function(n,t){return this.mix(this.rgb(0,0,0),n,t)},extract:function(n,t){return t=t.value-1,Array.isArray(n.value)?n.value[t]:Array(n)[t]},length:function(n){var t=Array.isArray(n.value)?n.value.length:1;return new i.Dimension(t)},"data-uri":function(t,r){var h,l,y;if("undefined"!=typeof n)return new i.URL(r||t,this.currentFileInfo).eval(this.env);var e=t.value,f=r&&r.value,p=u("fs"),c=u("path"),s=!1;if(arguments.length<2&&(f=e),this.env.isPathRelative(f)&&(f=this.currentFileInfo.relativeUrls?c.join(this.currentFileInfo.currentDirectory,f):c.join(this.currentFileInfo.entryPath,f)),arguments.length<2){try{h=u("mime")}catch(w){h=i._mime}e=h.lookup(f);l=h.charsets.lookup(e);s=["US-ASCII","UTF-8"].indexOf(l)<0;s&&(e+=";base64")}else s=/;base64$/.test(e);var o=p.readFileSync(f),a=32,v=parseInt(o.length/1024,10);return v>=a&&this.env.ieCompat!==!1?(this.env.silent||console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",f,v,a),new i.URL(r||t,this.currentFileInfo).eval(this.env)):(o=s?o.toString("base64"):encodeURIComponent(o),y='"data:'+e+","+o+'"',new i.URL(new i.Anonymous(y)))},"svg-gradient":function(n){function v(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]"};}arguments.length<3&&v();var e,f,r,h,o,y,c,s=Array.prototype.slice.call(arguments,1),l="linear",p='x="0" y="0" width="1" height="1"',a=!0,w={compress:!1},b=n.toCSS(w);switch(b){case"to bottom":e='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":e='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":e='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":e='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":l="radial";e='cx="50%" cy="50%" r="75%"';p='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"};}for(f='<?xml version="1.0" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><'+l+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+e+">",r=0;r<s.length;r+=1)s[r].value?(h=s[r].value[0],o=s[r].value[1]):(h=s[r],o=t),h instanceof i.Color&&((0===r||r+1===s.length)&&o===t||o instanceof i.Dimension)||v(),y=o?o.toCSS(w):0===r?"0%":"100%",c=h.alpha,f+='<stop offset="'+y+'" stop-color="'+h.toRGB()+'"'+(1>c?' stop-opacity="'+c+'"':"")+"/>";if(f+="<\/"+l+"Gradient><rect "+p+' fill="url(#gradient)" /><\/svg>',a)try{f=u("./encoder").encodeBase64(f)}catch(k){a=!1}return f="'data:image/svg+xml"+(a?";base64":"")+","+f+"'",new i.URL(new i.Anonymous(f))}};i._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(n){var r=u("path").extname(n),f=i._mime._types[r];if(f===t)throw new Error('Optional dependency "mime" is required for '+r);return f},charsets:{lookup:function(n){return n&&/^text\//.test(n)?"UTF-8":""}}};var s={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"},o={multiply:function(n,t){return n*t},screen:function(n,t){return n+t-n*t},overlay:function(n,t){return n*=2,1>=n?o.multiply(n,t):o.screen(n-1,t)},softlight:function(n,t){var i=1,r=n;return t>.5&&(r=1,i=n>.25?Math.sqrt(n):((16*n-12)*n+4)*n),n-(1-2*t)*r*(i-n)},hardlight:function(n,t){return o.overlay(t,n)},difference:function(n,t){return Math.abs(n-t)},exclusion:function(n,t){return n+t-2*n*t},average:function(n,t){return(n+t)/2},negation:function(n,t){return 1-Math.abs(n+t-1)}};i.defaultFunc={eval:function(){var n=this.value_,t=this.error_;if(t)throw t;if(null!=n)return n?i.True:i.False},value:function(n){this.value_=n},error:function(n){this.error_=n},reset:function(){this.value_=this.error_=null}};l();i.fround=function(n,t){var i;return n&&null!=n.numPrecision?(i=Math.pow(10,n.numPrecision),Math.round(t*i)/i):t};i.functionCall=function(n,t){this.env=n;this.currentFileInfo=t};i.functionCall.prototype=i.functions}(u("./tree")),function(n){n.colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(u("./tree")),function(n){n.debugInfo=function(t,i,r){var u="";if(t.dumpLineNumbers&&!t.compress)switch(t.dumpLineNumbers){case"comments":u=n.debugInfo.asComment(i);break;case"mediaquery":u=n.debugInfo.asMediaQuery(i);break;case"all":u=n.debugInfo.asComment(i)+(r||"")+n.debugInfo.asMediaQuery(i)}return u};n.debugInfo.asComment=function(n){return"/* line "+n.debugInfo.lineNumber+", "+n.debugInfo.fileName+" */\n"};n.debugInfo.asMediaQuery=function(n){return"@media -sass-debug-info{filename{font-family:"+("file://"+n.debugInfo.fileName).replace(/([.:\/\\])/g,function(n){return"\\"==n&&(n="/"),"\\"+n})+"}line{font-family:\\00003"+n.debugInfo.lineNumber+"}}\n"};n.find=function(n,t){for(var r,i=0;i<n.length;i++)if(r=t.call(n,n[i]))return r;return null};n.jsify=function(n){return Array.isArray(n.value)&&n.value.length>1?"["+n.value.map(function(n){return n.toCSS(!1)}).join(", ")+"]":n.toCSS(!1)};n.toCSS=function(n){var t=[];return this.genCSS(n,{add:function(n){t.push(n)},isEmpty:function(){return 0===t.length}}),t.join("")};n.outputRuleset=function(n,t,i){var r,f=i.length,u,e;if(n.tabLevel=(0|n.tabLevel)+1,n.compress){for(t.add("{"),r=0;f>r;r++)i[r].genCSS(n,t);return t.add("}"),void n.tabLevel--}if(u="\n"+Array(n.tabLevel).join("  "),e=u+"  ",f){for(t.add(" {"+e),i[0].genCSS(n,t),r=1;f>r;r++)t.add(e),i[r].genCSS(n,t);t.add(u+"}")}else t.add(" {"+u+"}");n.tabLevel--}}(u("./tree")),function(n){n.Alpha=function(n){this.value=n};n.Alpha.prototype={type:"Alpha",accept:function(n){this.value=n.visit(this.value)},eval:function(t){return this.value.eval?new n.Alpha(this.value.eval(t)):this},genCSS:function(n,t){t.add("alpha(opacity=");this.value.genCSS?this.value.genCSS(n,t):t.add(this.value);t.add(")")},toCSS:n.toCSS}}(u("../tree")),function(n){n.Anonymous=function(n,t,i,r){this.value=n.value||n;this.index=t;this.mapLines=r;this.currentFileInfo=i};n.Anonymous.prototype={type:"Anonymous",eval:function(){return new n.Anonymous(this.value,this.index,this.currentFileInfo,this.mapLines)},compare:function(n){if(!n.toCSS)return-1;var t=this.toCSS(),i=n.toCSS();return t===i?0:i>t?-1:1},genCSS:function(n,t){t.add(this.value,this.currentFileInfo,this.index,this.mapLines)},toCSS:n.toCSS}}(u("../tree")),function(n){n.Assignment=function(n,t){this.key=n;this.value=t};n.Assignment.prototype={type:"Assignment",accept:function(n){this.value=n.visit(this.value)},eval:function(t){return this.value.eval?new n.Assignment(this.key,this.value.eval(t)):this},genCSS:function(n,t){t.add(this.key+"=");this.value.genCSS?this.value.genCSS(n,t):t.add(this.value)},toCSS:n.toCSS}}(u("../tree")),function(n){n.Call=function(n,t,i,r){this.name=n;this.args=t;this.index=i;this.currentFileInfo=r};n.Call.prototype={type:"Call",accept:function(n){this.args&&(this.args=n.visitArray(this.args))},eval:function(t){var i,r,f=this.args.map(function(n){return n.eval(t)}),e=this.name.toLowerCase();if(e in n.functions)try{if(r=new n.functionCall(t,this.currentFileInfo),i=r[e].apply(r,f),null!=i)return i}catch(u){throw{type:u.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(u.message?": "+u.message:""),index:this.index,filename:this.currentFileInfo.filename};}return new n.Call(this.name,f,this.index,this.currentFileInfo)},genCSS:function(n,t){t.add(this.name+"(",this.currentFileInfo,this.index);for(var i=0;i<this.args.length;i++)this.args[i].genCSS(n,t),i+1<this.args.length&&t.add(", ");t.add(")")},toCSS:n.toCSS}}(u("../tree")),function(n){function i(n){return"#"+n.map(function(n){return n=t(Math.round(n),255),(16>n?"0":"")+n.toString(16)}).join("")}function t(n,t){return Math.min(Math.max(n,0),t)}n.Color=function(n,t){this.rgb=Array.isArray(n)?n:6==n.length?n.match(/.{2}/g).map(function(n){return parseInt(n,16)}):n.split("").map(function(n){return parseInt(n+n,16)});this.alpha="number"==typeof t?t:1};var r="transparent";n.Color.prototype={type:"Color",eval:function(){return this},luma:function(){var n=this.rgb[0]/255,t=this.rgb[1]/255,i=this.rgb[2]/255;return n=.03928>=n?n/12.92:Math.pow((n+.055)/1.055,2.4),t=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=i?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*t+.0722*i},genCSS:function(n,t){t.add(this.toCSS(n))},toCSS:function(i,u){var s=i&&i.compress&&!u,o=n.fround(i,this.alpha),e,f;return 1>o?0===o&&this.isTransparentKeyword?r:"rgba("+this.rgb.map(function(n){return t(Math.round(n),255)}).concat(t(o,1)).join(","+(s?"":" "))+")":(e=this.toRGB(),s&&(f=e.split(""),f[1]===f[2]&&f[3]===f[4]&&f[5]===f[6]&&(e="#"+f[1]+f[3]+f[5])),e)},operate:function(t,i,r){for(var f=[],e=this.alpha*(1-r.alpha)+r.alpha,u=0;3>u;u++)f[u]=n.operate(t,i,this.rgb[u],r.rgb[u]);return new n.Color(f,e)},toRGB:function(){return i(this.rgb)},toHSL:function(){var n,o,u=this.rgb[0]/255,t=this.rgb[1]/255,i=this.rgb[2]/255,h=this.alpha,r=Math.max(u,t,i),f=Math.min(u,t,i),s=(r+f)/2,e=r-f;if(r===f)n=o=0;else{switch(o=s>.5?e/(2-r-f):e/(r+f),r){case u:n=(t-i)/e+(i>t?6:0);break;case t:n=(i-u)/e+2;break;case i:n=(u-t)/e+4}n/=6}return{h:360*n,s:o,l:s,a:h}},toHSV:function(){var n,e,u=this.rgb[0]/255,t=this.rgb[1]/255,i=this.rgb[2]/255,s=this.alpha,r=Math.max(u,t,i),o=Math.min(u,t,i),h=r,f=r-o;if(e=0===r?0:f/r,r===o)n=0;else{switch(r){case u:n=(t-i)/f+(i>t?6:0);break;case t:n=(i-u)/f+2;break;case i:n=(u-t)/f+4}n/=6}return{h:360*n,s:e,v:h,a:s}},toARGB:function(){return i([255*this.alpha].concat(this.rgb))},compare:function(n){return n.rgb?n.rgb[0]===this.rgb[0]&&n.rgb[1]===this.rgb[1]&&n.rgb[2]===this.rgb[2]&&n.alpha===this.alpha?0:-1:-1}};n.Color.fromKeyword=function(t){if(t=t.toLowerCase(),n.colors.hasOwnProperty(t))return new n.Color(n.colors[t].slice(1));if(t===r){var i=new n.Color([0,0,0],0);return i.isTransparentKeyword=!0,i}}}(u("../tree")),function(n){n.Comment=function(n,t,i,r){this.value=n;this.silent=!!t;this.currentFileInfo=r};n.Comment.prototype={type:"Comment",genCSS:function(t,i){this.debugInfo&&i.add(n.debugInfo(t,this),this.currentFileInfo,this.index);i.add(this.value.trim())},toCSS:n.toCSS,isSilent:function(n){var t=this.currentFileInfo&&this.currentFileInfo.reference&&!this.isReferenced,i=n.compress&&!this.value.match(/^\/\*!/);return this.silent||t||i},eval:function(){return this},markReferenced:function(){this.isReferenced=!0}}}(u("../tree")),function(n){n.Condition=function(n,t,i,r,u){this.op=n.trim();this.lvalue=t;this.rvalue=i;this.index=r;this.negate=u};n.Condition.prototype={type:"Condition",accept:function(n){this.lvalue=n.visit(this.lvalue);this.rvalue=n.visit(this.rvalue)},eval:function(n){var t,i=this.lvalue.eval(n),r=this.rvalue.eval(n),u=this.index;return t=function(n){switch(n){case"and":return i&&r;case"or":return i||r;default:if(i.compare)t=i.compare(r);else{if(!r.compare)throw{type:"Type",message:"Unable to perform comparison",index:u};t=r.compare(i)}switch(t){case-1:return"<"===n||"=<"===n||"<="===n;case 0:return"="===n||">="===n||"=<"===n||"<="===n;case 1:return">"===n||">="===n}}}(this.op),this.negate?!t:t}}}(u("../tree")),function(n){n.DetachedRuleset=function(n,t){this.ruleset=n;this.frames=t};n.DetachedRuleset.prototype={type:"DetachedRuleset",accept:function(n){this.ruleset=n.visit(this.ruleset)},eval:function(t){var i=this.frames||t.frames.slice(0);return new n.DetachedRuleset(this.ruleset,i)},callEval:function(t){return this.ruleset.eval(this.frames?new n.evalEnv(t,this.frames.concat(t.frames)):t)}}}(u("../tree")),function(n){n.Dimension=function(i,r){this.value=parseFloat(i);this.unit=r&&r instanceof n.Unit?r:new n.Unit(r?[r]:t)};n.Dimension.prototype={type:"Dimension",accept:function(n){this.unit=n.visit(this.unit)},eval:function(){return this},toColor:function(){return new n.Color([this.value,this.value,this.value])},genCSS:function(t,i){if(t&&t.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var r=n.fround(t,this.value),u=String(r);if(0!==r&&1e-6>r&&r>-1e-6&&(u=r.toFixed(20).replace(/0+$/,"")),t&&t.compress){if(0===r&&this.unit.isLength())return void i.add(u);r>0&&1>r&&(u=u.substr(1))}i.add(u);this.unit.genCSS(t,i)},toCSS:n.toCSS,operate:function(t,i,r){var f=n.operate(t,i,this.value,r.value),u=this.unit.clone();if("+"===i||"-"===i){if(0===u.numerator.length&&0===u.denominator.length)u.numerator=r.unit.numerator.slice(0),u.denominator=r.unit.denominator.slice(0);else if(0!==r.unit.numerator.length||0!==u.denominator.length){if(r=r.convertTo(this.unit.usedUnits()),t.strictUnits&&r.unit.toString()!==u.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+u.toString()+"' and '"+r.unit.toString()+"'.");f=n.operate(t,i,this.value,r.value)}}else"*"===i?(u.numerator=u.numerator.concat(r.unit.numerator).sort(),u.denominator=u.denominator.concat(r.unit.denominator).sort(),u.cancel()):"/"===i&&(u.numerator=u.numerator.concat(r.unit.denominator).sort(),u.denominator=u.denominator.concat(r.unit.numerator).sort(),u.cancel());return new n.Dimension(f,u)},compare:function(t){if(t instanceof n.Dimension){var i,r,u,f;if(this.unit.isEmpty()||t.unit.isEmpty())i=this,r=t;else if(i=this.unify(),r=t.unify(),0!==i.unit.compare(r.unit))return-1;return u=i.value,f=r.value,f>u?-1:u>f?1:0}return-1},unify:function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},convertTo:function(t){var f,r,i,u,h,e=this.value,o=this.unit.clone(),s={};if("string"==typeof t){for(f in n.UnitConversions)n.UnitConversions[f].hasOwnProperty(t)&&(s={},s[f]=t);t=s}h=function(n,t){return i.hasOwnProperty(n)?(t?e/=i[n]/i[u]:e*=i[n]/i[u],u):n};for(r in t)t.hasOwnProperty(r)&&(u=t[r],i=n.UnitConversions[r],o.map(h));return o.cancel(),new n.Dimension(e,o)}};n.UnitConversions={length:{m:1,cm:.01,mm:.001,"in":.0254,px:.0254/96,pt:.0254/72,pc:.0254/6},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}};n.Unit=function(n,t,i){this.numerator=n?n.slice(0).sort():[];this.denominator=t?t.slice(0).sort():[];this.backupUnit=i};n.Unit.prototype={type:"Unit",clone:function(){return new n.Unit(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},genCSS:function(n,t){this.numerator.length>=1?t.add(this.numerator[0]):this.denominator.length>=1?t.add(this.denominator[0]):n&&n.strictUnits||!this.backupUnit||t.add(this.backupUnit)},toCSS:n.toCSS,toString:function(){for(var t=this.numerator.join("*"),n=0;n<this.denominator.length;n++)t+="/"+this.denominator[n];return t},compare:function(n){return this.is(n.toString())?0:-1},is:function(n){return this.toString()===n},isLength:function(){return Boolean(this.toCSS().match(/px|em|%|in|cm|mm|pc|pt|ex/))},isEmpty:function(){return 0===this.numerator.length&&0===this.denominator.length},isSingular:function(){return this.numerator.length<=1&&0===this.denominator.length},map:function(n){for(var t=0;t<this.numerator.length;t++)this.numerator[t]=n(this.numerator[t],!1);for(t=0;t<this.denominator.length;t++)this.denominator[t]=n(this.denominator[t],!0)},usedUnits:function(){var r,u,i={},t;u=function(n){return r.hasOwnProperty(n)&&!i[t]&&(i[t]=n),n};for(t in n.UnitConversions)n.UnitConversions.hasOwnProperty(t)&&(r=n.UnitConversions[t],this.map(u));return i},cancel:function(){for(var t,r,i={},u,n=0;n<this.numerator.length;n++)t=this.numerator[n],r||(r=t),i[t]=(i[t]||0)+1;for(n=0;n<this.denominator.length;n++)t=this.denominator[n],r||(r=t),i[t]=(i[t]||0)-1;this.numerator=[];this.denominator=[];for(t in i)if(i.hasOwnProperty(t))if(u=i[t],u>0)for(n=0;u>n;n++)this.numerator.push(t);else if(0>u)for(n=0;-u>n;n++)this.denominator.push(t);0===this.numerator.length&&0===this.denominator.length&&r&&(this.backupUnit=r);this.numerator.sort();this.denominator.sort()}}}(u("../tree")),function(n){n.Directive=function(n,t,i,r,u,f){this.name=n;this.value=t;i&&(this.rules=i,this.rules.allowImports=!0);this.index=r;this.currentFileInfo=u;this.debugInfo=f};n.Directive.prototype={type:"Directive",accept:function(n){var t=this.value,i=this.rules;i&&(i=n.visit(i));t&&(t=n.visit(t))},genCSS:function(t,i){var r=this.value,u=this.rules;i.add(this.name,this.currentFileInfo,this.index);r&&(i.add(" "),r.genCSS(t,i));u?n.outputRuleset(t,i,[u]):i.add(";")},toCSS:n.toCSS,eval:function(t){var r=this.value,i=this.rules;return r&&(r=r.eval(t)),i&&(i=i.eval(t),i.root=!0),new n.Directive(this.name,r,i,this.index,this.currentFileInfo,this.debugInfo)},variable:function(t){if(this.rules)return n.Ruleset.prototype.variable.call(this.rules,t)},find:function(){if(this.rules)return n.Ruleset.prototype.find.apply(this.rules,arguments)},rulesets:function(){if(this.rules)return n.Ruleset.prototype.rulesets.apply(this.rules)},markReferenced:function(){var n,t;if(this.isReferenced=!0,this.rules)for(t=this.rules.rules,n=0;n<t.length;n++)t[n].markReferenced&&t[n].markReferenced()}}}(u("../tree")),function(n){n.Element=function(t,i,r,u){this.combinator=t instanceof n.Combinator?t:new n.Combinator(t);this.value="string"==typeof i?i.trim():i?i:"";this.index=r;this.currentFileInfo=u};n.Element.prototype={type:"Element",accept:function(n){var t=this.value;this.combinator=n.visit(this.combinator);"object"==typeof t&&(this.value=n.visit(t))},eval:function(t){return new n.Element(this.combinator,this.value.eval?this.value.eval(t):this.value,this.index,this.currentFileInfo)},genCSS:function(n,t){t.add(this.toCSS(n),this.currentFileInfo,this.index)},toCSS:function(n){var t=this.value.toCSS?this.value.toCSS(n):this.value;return""===t&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(n||{})+t}};n.Attribute=function(n,t,i){this.key=n;this.op=t;this.value=i};n.Attribute.prototype={type:"Attribute",eval:function(t){return new n.Attribute(this.key.eval?this.key.eval(t):this.key,this.op,this.value&&this.value.eval?this.value.eval(t):this.value)},genCSS:function(n,t){t.add(this.toCSS(n))},toCSS:function(n){var t=this.key.toCSS?this.key.toCSS(n):this.key;return this.op&&(t+=this.op,t+=this.value.toCSS?this.value.toCSS(n):this.value),"["+t+"]"}};n.Combinator=function(n){this.value=" "===n?" ":n?n.trim():""};n.Combinator.prototype={type:"Combinator",_outputMap:{"":""," ":" ",":":" :","+":" + ","~":" ~ ",">":" > ","|":"|","^":" ^ ","^^":" ^^ "},_outputMapCompressed:{"":""," ":" ",":":" :","+":"+","~":"~",">":">","|":"|","^":"^","^^":"^^"},genCSS:function(n,t){t.add((n.compress?this._outputMapCompressed:this._outputMap)[this.value])},toCSS:n.toCSS}}(u("../tree")),function(n){n.Expression=function(n){this.value=n};n.Expression.prototype={type:"Expression",accept:function(n){this.value&&(this.value=n.visitArray(this.value))},eval:function(t){var i,r=this.parens&&!this.parensInOp,u=!1;return r&&t.inParenthesis(),this.value.length>1?i=new n.Expression(this.value.map(function(n){return n.eval(t)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(u=!0),i=this.value[0].eval(t)):i=this,r&&t.outOfParenthesis(),this.parens&&this.parensInOp&&!t.isMathOn()&&!u&&(i=new n.Paren(i)),i},genCSS:function(n,t){for(var i=0;i<this.value.length;i++)this.value[i].genCSS(n,t),i+1<this.value.length&&t.add(" ")},toCSS:n.toCSS,throwAwayComments:function(){this.value=this.value.filter(function(t){return!(t instanceof n.Comment)})}}}(u("../tree")),function(n){n.Extend=function(t,i,r){switch(this.selector=t,this.option=i,this.index=r,this.object_id=n.Extend.next_id++,this.parent_ids=[this.object_id],i){case"all":this.allowBefore=!0;this.allowAfter=!0;break;default:this.allowBefore=!1;this.allowAfter=!1}};n.Extend.next_id=0;n.Extend.prototype={type:"Extend",accept:function(n){this.selector=n.visit(this.selector)},eval:function(t){return new n.Extend(this.selector.eval(t),this.option,this.index)},clone:function(){return new n.Extend(this.selector,this.option,this.index)},findSelfSelectors:function(n){for(var i,r=[],t=0;t<n.length;t++)i=n[t].elements,t>0&&i.length&&""===i[0].combinator.value&&(i[0].combinator.value=" "),r=r.concat(n[t].elements);this.selfSelectors=[{elements:r}]}}}(u("../tree")),function(n){n.Import=function(n,i,r,u,f){if(this.options=r,this.index=u,this.path=n,this.features=i,this.currentFileInfo=f,this.options.less!==t||this.options.inline)this.css=!this.options.less||this.options.inline;else{var e=this.getPath();e&&/css([\?;].*)?$/.test(e)&&(this.css=!0)}};n.Import.prototype={type:"Import",accept:function(n){this.features&&(this.features=n.visit(this.features));this.path=n.visit(this.path);!this.options.inline&&this.root&&(this.root=n.visit(this.root))},genCSS:function(n,t){this.css&&(t.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(n,t),this.features&&(t.add(" "),this.features.genCSS(n,t)),t.add(";"))},toCSS:n.toCSS,getPath:function(){if(this.path instanceof n.Quoted){var i=this.path.value;return this.css!==t||/(\.[a-z]*$)|([\?;].*)$/.test(i)?i:i+".less"}return this.path instanceof n.URL?this.path.value.value:null},evalForImport:function(t){return new n.Import(this.path.eval(t),this.features,this.options,this.index,this.currentFileInfo)},evalPath:function(t){var i=this.path.eval(t),u=this.currentFileInfo&&this.currentFileInfo.rootpath,r;return i instanceof n.URL||(u&&(r=i.value,r&&t.isPathRelative(r)&&(i.value=u+r)),i.value=t.normalizePath(i.value)),i},eval:function(t){var i,f=this.features&&this.features.eval(t),r,u;if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline)return r=new n.Anonymous(this.root,0,{filename:this.importedFilename},!0),this.features?new n.Media([r],this.features.value):[r];if(this.css){if(u=new n.Import(this.evalPath(t),f,this.options,this.index),!u.css&&this.error)throw this.error;return u}return i=new n.Ruleset(null,this.root.rules.slice(0)),i.evalImports(t),this.features?new n.Media(i.rules,this.features.value):i.rules}}}(u("../tree")),function(n){n.JavaScript=function(n,t,i){this.escaped=i;this.expression=n;this.index=t};n.JavaScript.prototype={type:"JavaScript",eval:function(t){var i,s=this,o={},r=this.expression.replace(/@\{([\w-]+)\}/g,function(i,r){return n.jsify(new n.Variable("@"+r,s.index).eval(t))}),u,f;try{r=new Function("return ("+r+")")}catch(e){throw{message:"JavaScript evaluation error: "+e.message+" from `"+r+"`",index:this.index};}u=t.frames[0].variables();for(f in u)u.hasOwnProperty(f)&&(o[f.slice(1)]={value:u[f].value,toJS:function(){return this.value.eval(t).toCSS()}});try{i=r.call(o)}catch(e){throw{message:"JavaScript evaluation error: '"+e.name+": "+e.message.replace(/["]/g,"'")+"'",index:this.index};}return"number"==typeof i?new n.Dimension(i):"string"==typeof i?new n.Quoted('"'+i+'"',i,this.escaped,this.index):new n.Anonymous(Array.isArray(i)?i.join(", "):i)}}}(u("../tree")),function(n){n.Keyword=function(n){this.value=n};n.Keyword.prototype={type:"Keyword",eval:function(){return this},genCSS:function(n,t){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};t.add(this.value)},toCSS:n.toCSS,compare:function(t){return t instanceof n.Keyword?t.value===this.value?0:1:-1}};n.True=new n.Keyword("true");n.False=new n.Keyword("false")}(u("../tree")),function(n){n.Media=function(t,i,r,u){this.index=r;this.currentFileInfo=u;var f=this.emptySelectors();this.features=new n.Value(i);this.rules=[new n.Ruleset(f,t)];this.rules[0].allowImports=!0};n.Media.prototype={type:"Media",accept:function(n){this.features&&(this.features=n.visit(this.features));this.rules&&(this.rules=n.visitArray(this.rules))},genCSS:function(t,i){i.add("@media ",this.currentFileInfo,this.index);this.features.genCSS(t,i);n.outputRuleset(t,i,this.rules)},toCSS:n.toCSS,eval:function(t){var i,r;t.mediaBlocks||(t.mediaBlocks=[],t.mediaPath=[]);i=new n.Media(null,[],this.index,this.currentFileInfo);this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,i.debugInfo=this.debugInfo);r=!1;t.strictMath||(r=!0,t.strictMath=!0);try{i.features=this.features.eval(t)}finally{r&&(t.strictMath=!1)}return t.mediaPath.push(i),t.mediaBlocks.push(i),t.frames.unshift(this.rules[0]),i.rules=[this.rules[0].eval(t)],t.frames.shift(),t.mediaPath.pop(),0===t.mediaPath.length?i.evalTop(t):i.evalNested(t)},variable:function(t){return n.Ruleset.prototype.variable.call(this.rules[0],t)},find:function(){return n.Ruleset.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){return n.Ruleset.prototype.rulesets.apply(this.rules[0])},emptySelectors:function(){var i=new n.Element("","&",this.index,this.currentFileInfo),t=[new n.Selector([i],null,null,this.index,this.currentFileInfo)];return t[0].mediaEmpty=!0,t},markReferenced:function(){var n,t=this.rules[0].rules;for(this.rules[0].markReferenced(),this.isReferenced=!0,n=0;n<t.length;n++)t[n].markReferenced&&t[n].markReferenced()},evalTop:function(t){var i=this,r;return t.mediaBlocks.length>1&&(r=this.emptySelectors(),i=new n.Ruleset(r,t.mediaBlocks),i.multiMedia=!0),delete t.mediaBlocks,delete t.mediaPath,i},evalNested:function(t){for(var u,r=t.mediaPath.concat([this]),i=0;i<r.length;i++)u=r[i].features instanceof n.Value?r[i].features.value:r[i].features,r[i]=Array.isArray(u)?u:[u];return this.features=new n.Value(this.permute(r).map(function(t){for(t=t.map(function(t){return t.toCSS?t:new n.Anonymous(t)}),i=t.length-1;i>0;i--)t.splice(i,0,new n.Anonymous("and"));return new n.Expression(t)})),new n.Ruleset([],[])},permute:function(n){var t;if(0===n.length)return[];if(1===n.length)return n[0];for(var r=[],u=this.permute(n.slice(1)),i=0;i<u.length;i++)for(t=0;t<n[0].length;t++)r.push([n[0][t]].concat(u[i]));return r},bubbleSelectors:function(t){t&&(this.rules=[new n.Ruleset(t.slice(0),[this.rules[0]])])}}}(u("../tree")),function(n){n.mixin={};n.mixin.Call=function(t,i,r,u,f){this.selector=new n.Selector(t);this.arguments=i&&i.length?i:null;this.index=r;this.currentFileInfo=u;this.important=f};n.mixin.Call.prototype={type:"MixinCall",accept:function(n){this.selector&&(this.selector=n.visit(this.selector));this.arguments&&(this.arguments=n.visitArray(this.arguments))},eval:function(t){for(var c,r,i,u,v,d,y,e,p,l,a=[],g=!1,o=[],h=[],nt=n.defaultFunc,w=0,b=1,k=2,s=this.arguments&&this.arguments.map(function(n){return{name:n.name,value:n.value.eval(t)}}),f=0;f<t.frames.length;f++)if((c=t.frames[f].find(this.selector)).length>0){for(d=!0,i=0;i<c.length;i++){for(r=c[i],v=!1,u=0;u<t.frames.length;u++)if(!(r instanceof n.mixin.Definition)&&r===(t.frames[u].originalRuleset||t.frames[u])){v=!0;break}if(!v&&r.matchArgs(s,t)){if(e={mixin:r,group:w},r.matchCondition){for(u=0;2>u;u++)nt.value(u),h[u]=r.matchCondition(s,t);(h[0]||h[1])&&(h[0]!=h[1]&&(e.group=h[1]?b:k),o.push(e))}else o.push(e);g=!0}}for(nt.reset(),l=[0,0,0],i=0;i<o.length;i++)l[o[i].group]++;if(l[w]>0)p=k;else if(p=b,l[b]+l[k]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(s)+"`",index:this.index,filename:this.currentFileInfo.filename};for(i=0;i<o.length;i++)if(e=o[i].group,e===w||e===p)try{r=o[i].mixin;r instanceof n.mixin.Definition||(r=new n.mixin.Definition("",[],r.rules,null,!1),r.originalRuleset=c[i].originalRuleset||c[i]);Array.prototype.push.apply(a,r.evalCall(t,s,this.important).rules)}catch(tt){throw{message:tt.message,index:this.index,filename:this.currentFileInfo.filename,stack:tt.stack};}if(g){if(!this.currentFileInfo||!this.currentFileInfo.reference)for(f=0;f<a.length;f++)y=a[f],y.markReferenced&&y.markReferenced();return a}}throw d?{type:"Runtime",message:"No matching definition was found for `"+this.format(s)+"`",index:this.index,filename:this.currentFileInfo.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.currentFileInfo.filename};},format:function(n){return this.selector.toCSS().trim()+"("+(n?n.map(function(n){var t="";return n.name&&(t+=n.name+":"),t+(n.value.toCSS?n.value.toCSS():"???")}).join(", "):"")+")"}};n.mixin.Definition=function(t,i,r,u,f,e){this.name=t;this.selectors=[new n.Selector([new n.Element(null,t,this.index,this.currentFileInfo)])];this.params=i;this.condition=u;this.variadic=f;this.arity=i.length;this.rules=r;this._lookups={};this.required=i.reduce(function(n,t){return!t.name||t.name&&!t.value?n+1:n},0);this.parent=n.Ruleset.prototype;this.frames=e};n.mixin.Definition.prototype={type:"MixinDefinition",accept:function(n){this.params&&this.params.length&&(this.params=n.visitArray(this.params));this.rules=n.visitArray(this.rules);this.condition&&(this.condition=n.visit(this.condition))},variable:function(n){return this.parent.variable.call(this,n)},variables:function(){return this.parent.variables.call(this)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},evalParams:function(t,i,r,u){var y,o,f,e,h,c,p,a,l=new n.Ruleset(null,null),s=this.params.slice(0),v=0;if(i=new n.evalEnv(i,[l].concat(i.frames)),r)for(r=r.slice(0),v=r.length,f=0;v>f;f++)if(o=r[f],c=o&&o.name){for(p=!1,e=0;e<s.length;e++)if(!u[e]&&c===s[e].name){u[e]=o.value.eval(t);l.prependRule(new n.Rule(c,o.value.eval(t)));p=!0;break}if(p){r.splice(f,1);f--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+r[f].name+" not found"};}for(a=0,f=0;f<s.length;f++)if(!u[f]){if(o=r&&r[a],c=s[f].name)if(s[f].variadic){for(y=[],e=a;v>e;e++)y.push(r[e].value.eval(t));l.prependRule(new n.Rule(c,new n.Expression(y).eval(t)))}else{if(h=o&&o.value)h=h.eval(t);else{if(!s[f].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+v+" for "+this.arity+")"};h=s[f].value.eval(i);l.resetCache()}l.prependRule(new n.Rule(c,h));u[f]=h}if(s[f].variadic&&r)for(e=a;v>e;e++)u[e]=r[e].value.eval(t);a++}return l},eval:function(t){return new n.mixin.Definition(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||t.frames.slice(0))},evalCall:function(t,i,r){var f,u,e=[],o=this.frames?this.frames.concat(t.frames):t.frames,s=this.evalParams(t,new n.evalEnv(t,o),i,e);return s.prependRule(new n.Rule("@arguments",new n.Expression(e).eval(t))),f=this.rules.slice(0),u=new n.Ruleset(null,f),u.originalRuleset=this,u=u.eval(new n.evalEnv(t,[this,s].concat(o))),r&&(u=this.parent.makeImportant.apply(u)),u},matchCondition:function(t,i){return this.condition&&!this.condition.eval(new n.evalEnv(i,[this.evalParams(i,new n.evalEnv(i,this.frames.concat(i.frames)),t,[])].concat(this.frames).concat(i.frames)))?!1:!0},matchArgs:function(n,t){var u,r=n&&n.length||0,i;if(this.variadic){if(r<this.required-1)return!1}else if(r<this.required||r>this.params.length)return!1;for(u=Math.min(r,this.arity),i=0;u>i;i++)if(!this.params[i].name&&!this.params[i].variadic&&n[i].value.eval(t).toCSS()!=this.params[i].value.eval(t).toCSS())return!1;return!0}}}(u("../tree")),function(n){n.Negative=function(n){this.value=n};n.Negative.prototype={type:"Negative",accept:function(n){this.value=n.visit(this.value)},genCSS:function(n,t){t.add("-");this.value.genCSS(n,t)},toCSS:n.toCSS,eval:function(t){return t.isMathOn()?new n.Operation("*",[new n.Dimension(-1),this.value]).eval(t):new n.Negative(this.value.eval(t))}}}(u("../tree")),function(n){n.Operation=function(n,t,i){this.op=n.trim();this.operands=t;this.isSpaced=i};n.Operation.prototype={type:"Operation",accept:function(n){this.operands=n.visit(this.operands)},eval:function(t){var i=this.operands[0].eval(t),r=this.operands[1].eval(t);if(t.isMathOn()){if(i instanceof n.Dimension&&r instanceof n.Color&&(i=i.toColor()),r instanceof n.Dimension&&i instanceof n.Color&&(r=r.toColor()),!i.operate)throw{type:"Operation",message:"Operation on an invalid type"};return i.operate(t,this.op,r)}return new n.Operation(this.op,[i,r],this.isSpaced)},genCSS:function(n,t){this.operands[0].genCSS(n,t);this.isSpaced&&t.add(" ");t.add(this.op);this.isSpaced&&t.add(" ");this.operands[1].genCSS(n,t)},toCSS:n.toCSS};n.operate=function(n,t,i,r){switch(t){case"+":return i+r;case"-":return i-r;case"*":return i*r;case"/":return i/r}}}(u("../tree")),function(n){n.Paren=function(n){this.value=n};n.Paren.prototype={type:"Paren",accept:function(n){this.value=n.visit(this.value)},genCSS:function(n,t){t.add("(");this.value.genCSS(n,t);t.add(")")},toCSS:n.toCSS,eval:function(t){return new n.Paren(this.value.eval(t))}}}(u("../tree")),function(n){n.Quoted=function(n,t,i,r,u){this.escaped=i;this.value=t||"";this.quote=n.charAt(0);this.index=r;this.currentFileInfo=u};n.Quoted.prototype={type:"Quoted",genCSS:function(n,t){this.escaped||t.add(this.quote,this.currentFileInfo,this.index);t.add(this.value);this.escaped||t.add(this.quote)},toCSS:n.toCSS,eval:function(t){var i=this,r=this.value.replace(/`([^`]+)`/g,function(r,u){return new n.JavaScript(u,i.index,!0).eval(t).value}).replace(/@\{([\w-]+)\}/g,function(r,u){var f=new n.Variable("@"+u,i.index,i.currentFileInfo).eval(t,!0);return f instanceof n.Quoted?f.value:f.toCSS()});return new n.Quoted(this.quote+r+this.quote,r,this.escaped,this.index,this.currentFileInfo)},compare:function(n){if(!n.toCSS)return-1;var t=this.toCSS(),i=n.toCSS();return t===i?0:i>t?-1:1}}}(u("../tree")),function(n){function t(n,t){for(var r="",u=t.length,f={add:function(n){r+=n}},i=0;u>i;i++)t[i].eval(n).genCSS(n,f);return r}n.Rule=function(t,i,r,u,f,e,o){this.name=t;this.value=i instanceof n.Value||i instanceof n.Ruleset?i:new n.Value([i]);this.important=r?" "+r.trim():"";this.merge=u;this.index=f;this.currentFileInfo=e;this.inline=o||!1;this.variable=t.charAt&&"@"===t.charAt(0)};n.Rule.prototype={type:"Rule",accept:function(n){this.value=n.visit(this.value)},genCSS:function(n,t){t.add(this.name+(n.compress?":":": "),this.currentFileInfo,this.index);try{this.value.genCSS(n,t)}catch(i){throw i.index=this.index,i.filename=this.currentFileInfo.filename,i;}t.add(this.important+(this.inline||n.lastRule&&n.compress?"":";"),this.currentFileInfo,this.index)},toCSS:n.toCSS,eval:function(i){var f,e=!1,r=this.name;"string"!=typeof r&&(r=1===r.length&&r[0]instanceof n.Keyword?r[0].value:t(i,r));"font"!==r||i.strictMath||(e=!0,i.strictMath=!0);try{if(f=this.value.eval(i),!this.variable&&"DetachedRuleset"===f.type)throw{message:"Rulesets cannot be evaluated on a property.",index:this.index,filename:this.currentFileInfo.filename};return new n.Rule(r,f,this.important,this.merge,this.index,this.currentFileInfo,this.inline)}catch(u){throw"number"!=typeof u.index&&(u.index=this.index,u.filename=this.currentFileInfo.filename),u;}finally{e&&(i.strictMath=!1)}},makeImportant:function(){return new n.Rule(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)}}}(u("../tree")),function(n){n.RulesetCall=function(n){this.variable=n};n.RulesetCall.prototype={type:"RulesetCall",accept:function(){},eval:function(t){var i=new n.Variable(this.variable).eval(t);return i.callEval(t)}}}(u("../tree")),function(n){n.Ruleset=function(n,t,i){this.selectors=n;this.rules=t;this._lookups={};this.strictImports=i};n.Ruleset.prototype={type:"Ruleset",accept:function(n){this.paths?n.visitArray(this.paths,!0):this.selectors&&(this.selectors=n.visitArray(this.selectors));this.rules&&this.rules.length&&(this.rules=n.visitArray(this.rules))},eval:function(t){var h,w,a,i,v=this.selectors,b=n.defaultFunc,y=!1,f,c,e,u,p,o,r,s,k,l;if(v&&(w=v.length)){for(h=[],b.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),i=0;w>i;i++)a=v[i].eval(t),h.push(a),a.evaldCondition&&(y=!0);b.reset()}else y=!0;for(e=this.rules?this.rules.slice(0):null,u=new n.Ruleset(h,e,this.strictImports),u.originalRuleset=this,u.root=this.root,u.firstRoot=this.firstRoot,u.allowImports=this.allowImports,this.debugInfo&&(u.debugInfo=this.debugInfo),y||(e.length=0),p=t.frames,p.unshift(u),o=t.selectors,o||(t.selectors=o=[]),o.unshift(this.selectors),(u.root||u.allowImports||!u.strictImports)&&u.evalImports(t),r=u.rules,s=r?r.length:0,i=0;s>i;i++)(r[i]instanceof n.mixin.Definition||r[i]instanceof n.DetachedRuleset)&&(r[i]=r[i].eval(t));for(k=t.mediaBlocks&&t.mediaBlocks.length||0,i=0;s>i;i++)r[i]instanceof n.mixin.Call?(e=r[i].eval(t).filter(function(t){return t instanceof n.Rule&&t.variable?!u.variable(t.name):!0}),r.splice.apply(r,[i,1].concat(e)),s+=e.length-1,i+=e.length-1,u.resetCache()):r[i]instanceof n.RulesetCall&&(e=r[i].eval(t).rules.filter(function(t){return t instanceof n.Rule&&t.variable?!1:!0}),r.splice.apply(r,[i,1].concat(e)),s+=e.length-1,i+=e.length-1,u.resetCache());for(i=0;i<r.length;i++)f=r[i],f instanceof n.mixin.Definition||f instanceof n.DetachedRuleset||(r[i]=f=f.eval?f.eval(t):f);for(i=0;i<r.length;i++)if(f=r[i],f instanceof n.Ruleset&&f.selectors&&1===f.selectors.length&&f.selectors[0].isJustParentSelector())for(r.splice(i--,1),l=0;l<f.rules.length;l++)c=f.rules[l],c instanceof n.Rule&&c.variable||r.splice(++i,0,c);if(p.shift(),o.shift(),t.mediaBlocks)for(i=k;i<t.mediaBlocks.length;i++)t.mediaBlocks[i].bubbleSelectors(h);return u},evalImports:function(t){var i,u,r=this.rules;if(r)for(i=0;i<r.length;i++)r[i]instanceof n.Import&&(u=r[i].eval(t),u&&u.length?(r.splice.apply(r,[i,1].concat(u)),i+=u.length-1):r.splice(i,1,u),this.resetCache())},makeImportant:function(){return new n.Ruleset(this.selectors,this.rules.map(function(n){return n.makeImportant?n.makeImportant():n}),this.strictImports)},matchArgs:function(n){return!n||0===n.length},matchCondition:function(t,i){var r=this.selectors[this.selectors.length-1];return r.evaldCondition?r.condition&&!r.condition.eval(new n.evalEnv(i,i.frames))?!1:!0:!1},resetCache:function(){this._rulesets=null;this._variables=null;this._lookups={}},variables:function(){return this._variables||(this._variables=this.rules?this.rules.reduce(function(t,i){return i instanceof n.Rule&&i.variable===!0&&(t[i.name]=i),t},{}):{}),this._variables},variable:function(n){return this.variables()[n]},rulesets:function(){if(!this.rules)return null;for(var i,f=n.Ruleset,e=n.mixin.Definition,r=[],u=this.rules,o=u.length,t=0;o>t;t++)i=u[t],(i instanceof f||i instanceof e)&&r.push(i);return r},prependRule:function(n){var t=this.rules;t?t.unshift(n):this.rules=[n]},find:function(t,i){i=i||this;var u,r=[],f=t.toCSS();return f in this._lookups?this._lookups[f]:(this.rulesets().forEach(function(f){if(f!==i)for(var e=0;e<f.selectors.length;e++)if(u=t.match(f.selectors[e])){t.elements.length>u?Array.prototype.push.apply(r,f.find(new n.Selector(t.elements.slice(u)),i)):r.push(f);break}}),this._lookups[f]=r,r)},genCSS:function(t,i){var r,h,y,a,u,c,o=[],s=[],f,l,e,p,v,w;for(t.tabLevel=t.tabLevel||0,this.root||t.tabLevel++,l=t.compress?"":Array(t.tabLevel+1).join("  "),e=t.compress?"":Array(t.tabLevel).join("  "),r=0;r<this.rules.length;r++)u=this.rules[r],u.rules||u instanceof n.Media||u instanceof n.Directive||this.root&&u instanceof n.Comment?s.push(u):o.push(u);if(!this.root){for(a=n.debugInfo(t,this,e),a&&(i.add(a),i.add(e)),v=this.paths,w=v.length,f=t.compress?",":",\n"+e,r=0;w>r;r++)if(c=v[r],p=c.length)for(r>0&&i.add(f),t.firstSelector=!0,c[0].genCSS(t,i),t.firstSelector=!1,h=1;p>h;h++)c[h].genCSS(t,i);i.add((t.compress?"{":" {\n")+l)}for(r=0;r<o.length;r++)u=o[r],r+1!==o.length||this.root&&0!==s.length&&!this.firstRoot||(t.lastRule=!0),u.genCSS?u.genCSS(t,i):u.value&&i.add(u.value.toString()),t.lastRule?t.lastRule=!1:i.add(t.compress?"":"\n"+l);if(this.root||(i.add(t.compress?"}":"\n"+e+"}"),t.tabLevel--),f=(t.compress?"":"\n")+(this.root?l:e),y=s.length)for(o.length&&f&&i.add(f),s[0].genCSS(t,i),r=1;y>r;r++)f&&i.add(f),s[r].genCSS(t,i);i.isEmpty()||t.compress||!this.firstRoot||i.add("\n")},toCSS:n.toCSS,markReferenced:function(){if(this.selectors)for(var n=0;n<this.selectors.length;n++)this.selectors[n].markReferenced()},joinSelectors:function(n,t,i){for(var r=0;r<i.length;r++)this.joinSelector(n,t,i[r])},joinSelector:function(t,i,r){for(var a,v,b,e,f,o,c,s,y,l,p,k,h,w,u=0;u<r.elements.length;u++)f=r.elements[u],"&"===f.value&&(b=!0);if(b){for(h=[],e=[[]],u=0;u<r.elements.length;u++)if(f=r.elements[u],"&"!==f.value)h.push(f);else{for(w=[],h.length>0&&this.mergeElementsOnToSelectors(h,e),a=0;a<e.length;a++)if(o=e[a],0===i.length)o.length>0&&(o[0].elements=o[0].elements.slice(0),o[0].elements.push(new n.Element(f.combinator,"",f.index,f.currentFileInfo))),w.push(o);else for(v=0;v<i.length;v++)c=i[v],s=[],y=[],p=!0,o.length>0?(s=o.slice(0),k=s.pop(),l=r.createDerived(k.elements.slice(0)),p=!1):l=r.createDerived([]),c.length>1&&(y=y.concat(c.slice(1))),c.length>0&&(p=!1,l.elements.push(new n.Element(f.combinator,c[0].elements[0].value,f.index,f.currentFileInfo)),l.elements=l.elements.concat(c[0].elements.slice(1))),p||s.push(l),s=s.concat(y),w.push(s);e=w;h=[]}for(h.length>0&&this.mergeElementsOnToSelectors(h,e),u=0;u<e.length;u++)e[u].length>0&&t.push(e[u])}else if(i.length>0)for(u=0;u<i.length;u++)t.push(i[u].concat(r));else t.push([r])},mergeElementsOnToSelectors:function(t,i){var u,r;if(0===i.length)return void i.push([new n.Selector(t)]);for(u=0;u<i.length;u++)r=i[u],r.length>0?r[r.length-1]=r[r.length-1].createDerived(r[r.length-1].elements.concat(t)):r.push(new n.Selector(t))}}}(u("../tree")),function(n){n.Selector=function(n,t,i,r,u,f){this.elements=n;this.extendList=t;this.condition=i;this.currentFileInfo=u||{};this.isReferenced=f;i||(this.evaldCondition=!0)};n.Selector.prototype={type:"Selector",accept:function(n){this.elements&&(this.elements=n.visitArray(this.elements));this.extendList&&(this.extendList=n.visitArray(this.extendList));this.condition&&(this.condition=n.visit(this.condition))},createDerived:function(t,i,r){r=null!=r?r:this.evaldCondition;var u=new n.Selector(t,i||this.extendList,null,this.index,this.currentFileInfo,this.isReferenced);return u.evaldCondition=r,u.mediaEmpty=this.mediaEmpty,u},match:function(n){var t,i,r=this.elements,u=r.length;if(n.CacheElements(),t=n._elements.length,0===t||t>u)return 0;for(i=0;t>i;i++)if(r[i].value!==n._elements[i])return 0;return t},CacheElements:function(){var r,n,i,t="";if(!this._elements){for(r=this.elements.length,i=0;r>i;i++)if(n=this.elements[i],t+=n.combinator.value,n.value.value){if("string"!=typeof n.value.value){t="";break}t+=n.value.value}else t+=n.value;this._elements=t.match(/[,&#\.\w-]([\w-]|(\\.))*/g);this._elements?"&"===this._elements[0]&&this._elements.shift():this._elements=[]}},isJustParentSelector:function(){return!this.mediaEmpty&&1===this.elements.length&&"&"===this.elements[0].value&&(" "===this.elements[0].combinator.value||""===this.elements[0].combinator.value)},eval:function(n){var r=this.condition&&this.condition.eval(n),t=this.elements,i=this.extendList;return t=t&&t.map(function(t){return t.eval(n)}),i=i&&i.map(function(t){return t.eval(n)}),this.createDerived(t,i,r)},genCSS:function(n,t){var i,r;if(n&&n.firstSelector||""!==this.elements[0].combinator.value||t.add(" ",this.currentFileInfo,this.index),!this._css)for(i=0;i<this.elements.length;i++)r=this.elements[i],r.genCSS(n,t)},toCSS:n.toCSS,markReferenced:function(){this.isReferenced=!0},getIsReferenced:function(){return!this.currentFileInfo.reference||this.isReferenced},getIsOutput:function(){return this.evaldCondition}}}(u("../tree")),function(n){n.UnicodeDescriptor=function(n){this.value=n};n.UnicodeDescriptor.prototype={type:"UnicodeDescriptor",genCSS:function(n,t){t.add(this.value)},toCSS:n.toCSS,eval:function(){return this}}}(u("../tree")),function(n){n.URL=function(n,t,i){this.value=n;this.currentFileInfo=t;this.isEvald=i};n.URL.prototype={type:"Url",accept:function(n){this.value=n.visit(this.value)},genCSS:function(n,t){t.add("url(");this.value.genCSS(n,t);t.add(")")},toCSS:n.toCSS,eval:function(t){var r,i=this.value.eval(t),f,u;return this.isEvald||(r=this.currentFileInfo&&this.currentFileInfo.rootpath,r&&"string"==typeof i.value&&t.isPathRelative(i.value)&&(i.quote||(r=r.replace(/[\(\)'"\s]/g,function(n){return"\\"+n})),i.value=r+i.value),i.value=t.normalizePath(i.value),!t.urlArgs||i.value.match(/^\s*data:/))||(f=-1===i.value.indexOf("?")?"?":"&",u=f+t.urlArgs,-1!==i.value.indexOf("#")?i.value=i.value.replace("#",u+"#"):i.value+=u),new n.URL(i,this.currentFileInfo,!0)}}}(u("../tree")),function(n){n.Value=function(n){this.value=n};n.Value.prototype={type:"Value",accept:function(n){this.value&&(this.value=n.visitArray(this.value))},eval:function(t){return 1===this.value.length?this.value[0].eval(t):new n.Value(this.value.map(function(n){return n.eval(t)}))},genCSS:function(n,t){for(var i=0;i<this.value.length;i++)this.value[i].genCSS(n,t),i+1<this.value.length&&t.add(n&&n.compress?",":", ")},toCSS:n.toCSS}}(u("../tree")),function(n){n.Variable=function(n,t,i){this.name=n;this.index=t;this.currentFileInfo=i||{}};n.Variable.prototype={type:"Variable",eval:function(t){var r,i=this.name;if(0===i.indexOf("@@")&&(i="@"+new n.Variable(i.slice(1)).eval(t).value),this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+i,filename:this.currentFileInfo.file,index:this.index};if(this.evaluating=!0,r=n.find(t.frames,function(n){var r=n.variable(i);if(r)return r.value.eval(t)}))return this.evaluating=!1,r;throw{type:"Name",message:"variable "+i+" is undefined",filename:this.currentFileInfo.filename,index:this.index};}}}(u("../tree")),function(n){var r=["paths","optimization","files","contents","contentsIgnoredChars","relativeUrls","rootpath","strictImports","insecure","dumpLineNumbers","compress","processImports","syncImport","javascriptEnabled","mime","useFileCache","currentFileInfo"],i,t;n.parseEnv=function(n){if(t(n,this,r),this.contents||(this.contents={}),this.contentsIgnoredChars||(this.contentsIgnoredChars={}),this.files||(this.files={}),!this.currentFileInfo){var i=n&&n.filename||"input",u=i.replace(/[^\/\\]*$/,"");n&&(n.filename=null);this.currentFileInfo={filename:i,relativeUrls:this.relativeUrls,rootpath:n&&n.rootpath||"",currentDirectory:u,entryPath:u,rootFilename:i}}};i=["silent","verbose","compress","yuicompress","ieCompat","strictMath","strictUnits","cleancss","sourceMap","importMultiple","urlArgs"];n.evalEnv=function(n,r){t(n,this,i);this.frames=r||[]};n.evalEnv.prototype.inParenthesis=function(){this.parensStack||(this.parensStack=[]);this.parensStack.push(!0)};n.evalEnv.prototype.outOfParenthesis=function(){this.parensStack.pop()};n.evalEnv.prototype.isMathOn=function(){return this.strictMath?this.parensStack&&this.parensStack.length:!0};n.evalEnv.prototype.isPathRelative=function(n){return!/^(?:[a-z-]+:|\/)/.test(n)};n.evalEnv.prototype.normalizePath=function(n){var t,i=n.split("/").reverse();for(n=[];0!==i.length;)switch(t=i.pop()){case".":break;case"..":0===n.length||".."===n[n.length-1]?n.push(t):n.pop();break;default:n.push(t)}return n.join("/")};t=function(n,t,i){if(n)for(var r=0;r<i.length;r++)n.hasOwnProperty(i[r])&&(t[i[r]]=n[i[r]])}}(u("./tree")),function(n){function t(n){return n}function i(n,t){var u,r;for(u in n)if(n.hasOwnProperty(u))switch(r=n[u],typeof r){case"function":r.prototype&&r.prototype.type&&(r.prototype.typeIndex=t++);break;case"object":t=i(r,t)}return t}var u={visitDeeper:!0},r=!1;n.visitor=function(t){this._implementation=t;this._visitFnCache=[];r||(i(n,1),r=!0)};n.visitor.prototype={visit:function(n){var o,a;if(!n||(o=n.typeIndex,!o))return n;var s,f=this._visitFnCache,i=this._implementation,h=o<<1,l=1|h,r=f[h],e=f[l],c=u;return(c.visitDeeper=!0,r||(s="visit"+n.type,r=i[s]||t,e=i[s+"Out"]||t,f[h]=r,f[l]=e),r!==t)&&(a=r.call(i,n,c),i.isReplacing&&(n=a)),c.visitDeeper&&n&&n.accept&&n.accept(this),e!=t&&e.call(i,n),n},visitArray:function(n,t){var i,f,u,r;if(!n)return n;if(f=n.length,t||!this._implementation.isReplacing){for(i=0;f>i;i++)this.visit(n[i]);return n}for(u=[],i=0;f>i;i++)r=this.visit(n[i]),r.splice?r.length&&this.flatten(r,u):u.push(r);return u},flatten:function(n,t){t||(t=[]);for(var i,o,f,r,u=0,e=n.length;e>u;u++)if(i=n[u],i.splice)for(f=0,o=i.length;o>f;f++)r=i[f],r.splice?r.length&&this.flatten(r,t):t.push(r);else t.push(i);return t}}}(u("./tree")),function(n){n.importVisitor=function(t,i,r,u,f){if(this._visitor=new n.visitor(this),this._importer=t,this._finish=i,this.env=r||new n.evalEnv,this.importCount=0,this.onceFileDetectionMap=u||{},this.recursionDetector={},f)for(var e in f)f.hasOwnProperty(e)&&(this.recursionDetector[e]=!0)};n.importVisitor.prototype={isReplacing:!0,run:function(n){var t;try{this._visitor.visit(n)}catch(i){t=i}this.isFinished=!0;0===this.importCount&&this._finish(t)},visitImport:function(t,i){var f,r=this,o=t.options.inline,u;if(!t.css||o){try{f=t.evalForImport(this.env)}catch(e){e.filename||(e.index=t.index,e.filename=t.currentFileInfo.filename);t.css=!0;t.error=e}f&&(!f.css||o)&&(t=f,this.importCount++,u=new n.evalEnv(this.env,this.env.frames.slice(0)),t.options.multiple&&(u.importMultiple=!0),this._importer.push(t.getPath(),t.currentFileInfo,t.options,function(i,f,e,s){var h,c;if(i&&!i.filename&&(i.index=t.index,i.filename=t.currentFileInfo.filename),u.importMultiple||(t.skip=e?!0:function(){return s in r.onceFileDetectionMap?!0:(r.onceFileDetectionMap[s]=!0,!1)}),h=function(n){r.importCount--;0===r.importCount&&r.isFinished&&r._finish(n)},f&&(t.root=f,t.importedFilename=s,c=e||s in r.recursionDetector,!o&&(u.importMultiple||!c)))return r.recursionDetector[s]=!0,void new n.importVisitor(r._importer,h,u,r.onceFileDetectionMap,r.recursionDetector).run(f);h()}))}return i.visitDeeper=!1,t},visitRule:function(n,t){return t.visitDeeper=!1,n},visitDirective:function(n){return this.env.frames.unshift(n),n},visitDirectiveOut:function(){this.env.frames.shift()},visitMixinDefinition:function(n){return this.env.frames.unshift(n),n},visitMixinDefinitionOut:function(){this.env.frames.shift()},visitRuleset:function(n){return this.env.frames.unshift(n),n},visitRulesetOut:function(){this.env.frames.shift()},visitMedia:function(n){return this.env.frames.unshift(n.ruleset),n},visitMediaOut:function(){this.env.frames.shift()}}}(u("./tree")),function(n){n.joinSelectorVisitor=function(){this.contexts=[[]];this._visitor=new n.visitor(this)};n.joinSelectorVisitor.prototype={run:function(n){return this._visitor.visit(n)},visitRule:function(n,t){t.visitDeeper=!1},visitMixinDefinition:function(n,t){t.visitDeeper=!1},visitRuleset:function(n){var t,r=this.contexts[this.contexts.length-1],i=[];this.contexts.push(i);n.root||(t=n.selectors,t&&(t=t.filter(function(n){return n.getIsOutput()}),n.selectors=t.length?t:t=null,t&&n.joinSelectors(i,r,t)),t||(n.rules=null),n.paths=i)},visitRulesetOut:function(){this.contexts.length=this.contexts.length-1},visitMedia:function(n){var t=this.contexts[this.contexts.length-1];n.rules[0].root=0===t.length||t[0].multiMedia}}}(u("./tree")),function(n){n.toCSSVisitor=function(t){this._visitor=new n.visitor(this);this._env=t};n.toCSSVisitor.prototype={isReplacing:!0,run:function(n){return this._visitor.visit(n)},visitRule:function(n){return n.variable?[]:n},visitMixinDefinition:function(n){return n.frames=[],[]},visitExtend:function(){return[]},visitComment:function(n){return n.isSilent(this._env)?[]:n},visitMedia:function(n,t){return n.accept(this._visitor),t.visitDeeper=!1,n.rules.length?n:[]},visitDirective:function(t){if(t.currentFileInfo.reference&&!t.isReferenced)return[];if("@charset"===t.name){if(this.charset){if(t.debugInfo){var i=new n.Comment("/* "+t.toCSS(this._env).replace(/\n/g,"")+" */\n");return i.debugInfo=t.debugInfo,this._visitor.visit(i)}return[]}this.charset=!0}return t},checkPropertiesInRoot:function(t){for(var i,r=0;r<t.length;r++)if(i=t[r],i instanceof n.Rule&&!i.variable)throw{message:"properties must be inside selector blocks, they cannot be in the root.",index:i.index,filename:i.currentFileInfo?i.currentFileInfo.filename:null};},visitRuleset:function(t,i){var f,u=[];if(t.firstRoot&&this.checkPropertiesInRoot(t.rules),t.root)t.accept(this._visitor),i.visitDeeper=!1,(t.firstRoot||t.rules&&t.rules.length>0)&&u.splice(0,0,t);else{t.paths&&(t.paths=t.paths.filter(function(t){var i;for(" "===t[0].elements[0].combinator.value&&(t[0].elements[0].combinator=new n.Combinator("")),i=0;i<t.length;i++)if(t[i].getIsReferenced()&&t[i].getIsOutput())return!0;return!1}));for(var r=t.rules,o=r?r.length:0,e=0;o>e;)f=r[e],f&&f.rules?(u.push(this._visitor.visit(f)),r.splice(e,1),o--):e++;o>0?t.accept(this._visitor):t.rules=null;i.visitDeeper=!1;r=t.rules;r&&(this._mergeRules(r),r=t.rules);r&&(this._removeDuplicateRules(r),r=t.rules);r&&r.length>0&&t.paths.length>0&&u.splice(0,0,t)}return 1===u.length?u[0]:u},_removeDuplicateRules:function(t){var u,i,f,r,e;if(t)for(r={},f=t.length-1;f>=0;f--)(i=t[f],i instanceof n.Rule)&&(r[i.name]?(u=r[i.name],u instanceof n.Rule&&(u=r[i.name]=[r[i.name].toCSS(this._env)]),e=i.toCSS(this._env),-1!==u.indexOf(e)?t.splice(f,1):u.push(e)):r[i.name]=i)},_mergeRules:function(t){if(t){for(var u,i,f,r={},e=0;e<t.length;e++)i=t[e],i instanceof n.Rule&&i.merge&&(f=[i.name,i.important?"!":""].join(","),r[f]?t.splice(e--,1):r[f]=[],r[f].push(i));Object.keys(r).map(function(t){function o(t){return new n.Expression(t.map(function(n){return n.value}))}function s(t){return new n.Value(t.map(function(n){return n}))}if(u=r[t],u.length>1){i=u[0];var e=[],f=[];u.map(function(n){"+"===n.merge&&(f.length>0&&e.push(o(f)),f=[]);f.push(n)});e.push(o(f));i.value=s(e)}})}}}}(u("./tree")),function(n){n.extendFinderVisitor=function(){this._visitor=new n.visitor(this);this.contexts=[];this.allExtendsStack=[[]]};n.extendFinderVisitor.prototype={run:function(n){return n=this._visitor.visit(n),n.allExtends=this.allExtendsStack[0],n},visitRule:function(n,t){t.visitDeeper=!1},visitMixinDefinition:function(n,t){t.visitDeeper=!1},visitRuleset:function(t){var s;if(!t.root){for(var u,f,r,e=[],o=t.rules,l=o?o.length:0,i=0;l>i;i++)t.rules[i]instanceof n.Extend&&(e.push(o[i]),t.extendOnEveryPath=!0);for(s=t.paths,i=0;i<s.length;i++){var h=s[i],a=h[h.length-1],c=a.extendList;for(r=c?c.slice(0).concat(e):e,r&&(r=r.map(function(n){return n.clone()})),u=0;u<r.length;u++)this.foundExtends=!0,f=r[u],f.findSelfSelectors(h),f.ruleset=t,0===u&&(f.firstExtendOnThisSelectorPath=!0),this.allExtendsStack[this.allExtendsStack.length-1].push(f)}this.contexts.push(t.selectors)}},visitRulesetOut:function(n){n.root||(this.contexts.length=this.contexts.length-1)},visitMedia:function(n){n.allExtends=[];this.allExtendsStack.push(n.allExtends)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(n){n.allExtends=[];this.allExtendsStack.push(n.allExtends)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}};n.processExtendsVisitor=function(){this._visitor=new n.visitor(this)};n.processExtendsVisitor.prototype={run:function(t){var i=new n.extendFinderVisitor;return i.run(t),i.foundExtends?(t.allExtends=t.allExtends.concat(this.doExtendChaining(t.allExtends,t.allExtends)),this.allExtendsStack=[t.allExtends],this._visitor.visit(t)):t},doExtendChaining:function(t,i,r){var h,c,l,o,a,s,u,f,e=[],v=this,y,p;for(r=r||0,h=0;h<t.length;h++)for(c=0;c<i.length;c++)s=t[h],u=i[c],s.parent_ids.indexOf(u.object_id)>=0||(a=[u.selfSelectors[0]],l=v.findMatch(s,a),l.length&&s.selfSelectors.forEach(function(t){o=v.extendSelector(l,a,t);f=new n.Extend(u.selector,u.option,0);f.selfSelectors=o;o[o.length-1].extendList=[f];e.push(f);f.ruleset=u.ruleset;f.parent_ids=f.parent_ids.concat(u.parent_ids,s.parent_ids);u.firstExtendOnThisSelectorPath&&(f.firstExtendOnThisSelectorPath=!0,u.ruleset.paths.push(o))}));if(e.length){if(this.extendChainCount++,r>100){y="{unable to calculate}";p="{unable to calculate}";try{y=e[0].selfSelectors[0].toCSS();p=e[0].selector.toCSS()}catch(w){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+y+":extend("+p+")"};}return e.concat(v.doExtendChaining(e,i,r+1))}return e},visitRule:function(n,t){t.visitDeeper=!1},visitMixinDefinition:function(n,t){t.visitDeeper=!1},visitSelector:function(n,t){t.visitDeeper=!1},visitRuleset:function(n){var e;if(!n.root){for(var u,r,i,f=this.allExtendsStack[this.allExtendsStack.length-1],o=[],s=this,t=0;t<f.length;t++)for(r=0;r<n.paths.length;r++)(i=n.paths[r],n.extendOnEveryPath)||(e=i[i.length-1].extendList,e&&e.length||(u=this.findMatch(f[t],i),u.length&&f[t].selfSelectors.forEach(function(n){o.push(s.extendSelector(u,i,n))})));n.paths=n.paths.concat(o)}},findMatch:function(n,t){for(var o,r,s,h,f,i,a=this,c=n.selector.elements,e=[],l=[],u=0;u<t.length;u++)for(o=t[u],r=0;r<o.elements.length;r++)for(s=o.elements[r],(n.allowBefore||0===u&&0===r)&&e.push({pathIndex:u,index:r,matched:0,initialCombinator:s.combinator}),f=0;f<e.length;f++)i=e[f],h=s.combinator.value,""===h&&0===r&&(h=" "),!a.isElementValuesEqual(c[i.matched].value,s.value)||i.matched>0&&c[i.matched].combinator.value!==h?i=null:i.matched++,i&&(i.finished=i.matched===c.length,i.finished&&!n.allowAfter&&(r+1<o.elements.length||u+1<t.length)&&(i=null)),i?i.finished&&(i.length=c.length,i.endPathIndex=u,i.endPathElementIndex=r+1,e.length=0,l.push(i)):(e.splice(f,1),f--);return l},isElementValuesEqual:function(t,i){if("string"==typeof t||"string"==typeof i)return t===i;if(t instanceof n.Attribute)return t.op!==i.op||t.key!==i.key?!1:t.value&&i.value?(t=t.value.value||t.value,i=i.value.value||i.value,t===i):t.value||i.value?!1:!0;if(t=t.value,i=i.value,t instanceof n.Selector){if(!(i instanceof n.Selector)||t.elements.length!==i.elements.length)return!1;for(var r=0;r<t.elements.length;r++)if(t.elements[r].combinator.value!==i.elements[r].combinator.value&&(0!==r||(t.elements[r].combinator.value||" ")!==(i.elements[r].combinator.value||" "))||!this.isElementValuesEqual(t.elements[r].value,i.elements[r].value))return!1;return!0}return!1},extendSelector:function(t,i,r){for(var c,l,e,h,f=0,o=0,u=[],s=0;s<t.length;s++)e=t[s],c=i[e.pathIndex],l=new n.Element(e.initialCombinator,r.elements[0].value,r.elements[0].index,r.elements[0].currentFileInfo),e.pathIndex>f&&o>0&&(u[u.length-1].elements=u[u.length-1].elements.concat(i[f].elements.slice(o)),o=0,f++),h=c.elements.slice(o,e.index).concat([l]).concat(r.elements.slice(1)),f===e.pathIndex&&s>0?u[u.length-1].elements=u[u.length-1].elements.concat(h):(u=u.concat(i.slice(f,e.pathIndex)),u.push(new n.Selector(h))),f=e.endPathIndex,o=e.endPathElementIndex,o>=i[f].elements.length&&(o=0,f++);return f<i.length&&o>0&&(u[u.length-1].elements=u[u.length-1].elements.concat(i[f].elements.slice(o)),f++),u=u.concat(i.slice(f,i.length))},visitRulesetOut:function(){},visitMedia:function(n){var t=n.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);t=t.concat(this.doExtendChaining(t,n.allExtends));this.allExtendsStack.push(t)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(n){var t=n.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);t=t.concat(this.doExtendChaining(t,n.allExtends));this.allExtendsStack.push(t)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}}}(u("./tree")),function(n){n.sourceMapOutput=function(n){this._css=[];this._rootNode=n.rootNode;this._writeSourceMap=n.writeSourceMap;this._contentsMap=n.contentsMap;this._contentsIgnoredCharsMap=n.contentsIgnoredCharsMap;this._sourceMapFilename=n.sourceMapFilename;this._outputFilename=n.outputFilename;this._sourceMapURL=n.sourceMapURL;n.sourceMapBasepath&&(this._sourceMapBasepath=n.sourceMapBasepath.replace(/\\/g,"/"));this._sourceMapRootpath=n.sourceMapRootpath;this._outputSourceFiles=n.outputSourceFiles;this._sourceMapGeneratorConstructor=n.sourceMapGenerator||u("source-map").SourceMapGenerator;this._sourceMapRootpath&&"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/");this._lineNumber=0;this._column=0};n.sourceMapOutput.prototype.normalizeFilename=function(n){return n=n.replace(/\\/g,"/"),this._sourceMapBasepath&&0===n.indexOf(this._sourceMapBasepath)&&(n=n.substring(this._sourceMapBasepath.length),("\\"===n.charAt(0)||"/"===n.charAt(0))&&(n=n.substring(1))),(this._sourceMapRootpath||"")+n};n.sourceMapOutput.prototype.add=function(n,t,i,r){var f,o,s,h,u,e;if(n){if(t&&(e=this._contentsMap[t.filename],this._contentsIgnoredCharsMap[t.filename]&&(i-=this._contentsIgnoredCharsMap[t.filename],0>i&&(i=0),e=e.slice(this._contentsIgnoredCharsMap[t.filename])),e=e.substring(0,i),o=e.split("\n"),h=o[o.length-1]),f=n.split("\n"),s=f[f.length-1],t)if(r)for(u=0;u<f.length;u++)this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+u+1,column:0===u?this._column:0},original:{line:o.length+u,column:0===u?h.length:0},source:this.normalizeFilename(t.filename)});else this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+1,column:this._column},original:{line:o.length,column:h.length},source:this.normalizeFilename(t.filename)});1===f.length?this._column+=s.length:(this._lineNumber+=f.length-1,this._column=s.length);this._css.push(n)}};n.sourceMapOutput.prototype.isEmpty=function(){return 0===this._css.length};n.sourceMapOutput.prototype.toCSS=function(n){var t,r,i,u;if(this._sourceMapGenerator=new this._sourceMapGeneratorConstructor({file:this._outputFilename,sourceRoot:null}),this._outputSourceFiles)for(t in this._contentsMap)this._contentsMap.hasOwnProperty(t)&&(r=this._contentsMap[t],this._contentsIgnoredCharsMap[t]&&(r=r.slice(this._contentsIgnoredCharsMap[t])),this._sourceMapGenerator.setSourceContent(this.normalizeFilename(t),r));return(this._rootNode.genCSS(n,this),this._css.length>0)&&(u=JSON.stringify(this._sourceMapGenerator.toJSON()),this._sourceMapURL?i=this._sourceMapURL:this._sourceMapFilename&&(i=this.normalizeFilename(this._sourceMapFilename)),this._writeSourceMap?this._writeSourceMap(u):i="data:application/json,"+encodeURIComponent(u),i&&this._css.push("/*# sourceMappingURL="+i+" */")),this._css.join("")}}(u("./tree")),c=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol),i.env=i.env||("127.0.0.1"==location.hostname||"0.0.0.0"==location.hostname||"localhost"==location.hostname||location.port&&location.port.length>0||c?"development":"production"),f={debug:3,info:2,errors:1,none:0},i.logLevel="undefined"!=typeof i.logLevel?i.logLevel:"development"===i.env?f.debug:f.errors,i.async=i.async||!1,i.fileAsync=i.fileAsync||!1,i.poll=i.poll||(c?1e3:1500),i.functions)for(v in i.functions)i.functions.hasOwnProperty(v)&&(i.tree.functions[v]=i.functions[v]);w=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);w&&(i.dumpLineNumbers=w[1]);var tt=/^text\/(x-)?less$/,o=null,b={};if(i.watch=function(){return i.watchMode||(i.env="development",lt()),this.watchMode=!0,!0},i.unwatch=function(){return clearInterval(i.watchTimer),this.watchMode=!1,!1},/!watch/.test(location.hash)&&i.watch(),"development"!=i.env)try{o="undefined"==typeof n.localStorage?null:n.localStorage}catch(at){}for(h=document.getElementsByTagName("link"),i.sheets=[],s=0;s<h.length;s++)("stylesheet/less"===h[s].rel||h[s].rel.match(/stylesheet/)&&h[s].type.match(tt))&&i.sheets.push(h[s]);i.modifyVars=function(n){i.refresh(!1,n)};i.refresh=function(n,t){var u,r;u=r=new Date;nt(function(n,t,o,s,h){if(n)return p(n,s.href);if(h.local)e("loading "+s.href+" from cache.",f.info);else{e("parsed "+s.href+" successfully.",f.debug);var c=t.toCSS(i);c=k(c);l(c,s,h.lastModified)}e("css for "+s.href+" generated in "+(new Date-r)+"ms",f.info);0===h.remaining&&e("less has finished. css generated in "+(new Date-u)+"ms",f.info);r=new Date},n,t);d(t)};i.refreshStyles=d;i.Parser.fileLoader=g;i.refresh("development"===i.env);"function"==typeof define&&define.amd&&define(function(){return i})}(window)