From 7422890c87c1c5d398ab8a8e8cdcdb3ac199c8e0 Mon Sep 17 00:00:00 2001 From: Tiavina Date: Thu, 4 Sep 2025 16:53:00 +0300 Subject: [PATCH 1/2] dv thanato list ttc value in facture list --- gestion/lib/Db/Bdd.php | 99 ++++++++++++++++++++++++++- gestion/lib/Helpers/PriceHelpers.php | 5 ++ gestion/src/js/objects/facture.mjs | 3 + gestion/templates/content/facture.php | 1 + 4 files changed, 107 insertions(+), 1 deletion(-) diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index 4f8ba57..e9daaf0 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -513,6 +513,7 @@ class Bdd foreach($facturesList as $currentFacture) { $produits = $this->getProduitsDevisByDevisId($currentFacture->id_devis); $currentFacture->produits = $produits; + $currentFacture->totalPrices = $this->getFactureTotalPrices($currentFacture->id); } return json_encode($facturesList); } @@ -4944,7 +4945,7 @@ COMMENTAIRES: ".$comment; $conditions = [$clientGroupFacturationId,$year,$month]; if(!empty($mentionFilters)) { $mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?')); - $sql .= " AND ". $this->tableprefix."devis.mentions IN ($mentionsFilterPlaceholders)"; + $sql .= " AND "."devis.mentions IN ($mentionsFilterPlaceholders)"; $conditions = array_merge($conditions, $mentionFilters); } $sql .= ";"; @@ -5172,6 +5173,26 @@ COMMENTAIRES: ".$comment; return $devisList; } + public function getDevisIdsGroupByFactureId($factureId,$mentionFilters = []){ + $sql = "SELECT devis.id + FROM ".$this->tableprefix."devis as devis + WHERE devis.fk_facture_id = ? "; + + $conditions = [$factureId]; + if(!empty($mentionFilters)){ + $mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?')); + $sql .= " AND devis.mentions IN ($mentionsFilterPlaceholders)"; + $conditions = array_merge($conditions, $mentionFilters); + } + $sql.= ";"; + $devisList = $this->execSQLNoJsonReturn($sql,$conditions); + $devisIds = []; + foreach($devisList as $devis){ + $devisIds[] = $devis['id']; + } + return $devisIds; + } + public function getDevisDataGroupByFactureId($factureId, $mentionFilters = []) { $sql = "SELECT @@ -5723,4 +5744,80 @@ COMMENTAIRES: ".$comment; return null; } + + private function getProductsTotalPrices($products) + { + $configs = json_decode($this->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD)); + $currentConfig = $configs[0]; + $totalHt = 0; + $totalTtc = 0; + foreach ($products as $product) { + $valueHt = $product['produit_price'] * $product['quantite']; + $valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt, $currentConfig->tva_default); + $totalHt += $valueHt; + $totalTtc += $valueTtc; + } + return [ + "total_ht" => $totalHt, + "total_ttc" => $totalTtc, + "tva" => $currentConfig->tva_default + ]; + } + + private function getDevisIdsListByFactureId($factureId){ + $factureData = $this->getFactureByFactureId(factureId: $factureId); + $isFactureGroupOfDevis = $factureData["facture_type"] == FactureTypeConstant::TYPE_GROUP; + $factureDevisIdsList = []; + if($isFactureGroupOfDevis){ + $isFactureForSingleClient = $factureData['fk_client_id'] != null && $factureData['fk_client_id'] != 0; + $devisMentionFilters = [ + DevisMentionConstant::FACTURED_FORMATTED, + DevisMentionConstant::FACTURED + ]; + $devis = $this->getDevisByFkFactureId($factureId); + $factureGroupIsRelatedToAnyDevis = $devis != null; + if (!$factureGroupIsRelatedToAnyDevis) { + if($isFactureForSingleClient){ + $factureDevisIdsList = $this->getDevisIdsByClientIdAndMonthYear( + $factureData['fk_client_id'], + $factureData['month'], + $factureData['year'],$devisMentionFilters + ); + }else{ + $factureDevisIdsList = $this->getDevisIdsByClientGroupFacturationIdAndMonthYear( + $factureData['fk_client_group_facturation_id'], + $factureData['month'], + $factureData['year'],$devisMentionFilters + ); + } + }else{ + $factureDevisIdsList = $this->getDevisIdsGroupByFactureId($factureId, $devisMentionFilters ); + } + } + else{ + $factureDevisIdsList = $factureData['id_devis'] ? [$factureData['id_devis']] : []; + } + return $factureDevisIdsList; + } + + private function getFactureTotalPrices($factureId) + { + $factureDevisIds = $this->getDevisIdsListByFactureId($factureId); + $totalHt = 0; + $totalTtc = 0; + $tva = 0; + foreach($factureDevisIds as $devisId){ + $clientTvaStatus = $this->getClientTvaStatus($devisId,BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD); + $products = $this->getDevisProduits($devisId); + $totalPrices = $this->getProductsTotalPrices($products); + $totalHt += $totalPrices["total_ht"]; + $totalTtc += $clientTvaStatus == 1 ? $totalPrices["total_ttc"] : $totalPrices["total_ht"]; + $tva = $totalPrices["tva"]; + } + return [ + "total_ht" => PriceHelpers::formatDecimalPriceWithCurrency($totalHt), + "total_ttc" => PriceHelpers::formatDecimalPriceWithCurrency($totalTtc), + "tva" => PriceHelpers::formatDecimalPriceWithCurrency($tva) + ]; + } } diff --git a/gestion/lib/Helpers/PriceHelpers.php b/gestion/lib/Helpers/PriceHelpers.php index 55e3b3d..55b395a 100644 --- a/gestion/lib/Helpers/PriceHelpers.php +++ b/gestion/lib/Helpers/PriceHelpers.php @@ -17,4 +17,9 @@ class PriceHelpers return number_format($price,2,'.',''); } + public static function formatDecimalPriceWithCurrency($price,$currency = '€') + { + return self::formatDecimalPrice($price) . $currency; + } + } diff --git a/gestion/src/js/objects/facture.mjs b/gestion/src/js/objects/facture.mjs index 141703a..3abfc84 100644 --- a/gestion/src/js/objects/facture.mjs +++ b/gestion/src/js/objects/facture.mjs @@ -58,6 +58,8 @@ export class Facture { this.clientName = ((myresp.facture_group_name == null || myresp.facture_group_name.length == 0) ? '-' : myresp.facture_group_name); } } + + this.totalTtc = myresp?.totalPrices?.total_ttc ?? 0; } getDocumentStateLabel(documentState){ @@ -86,6 +88,7 @@ export class Facture { '
' + this.payment_date + '
', '
' + this.isDocumentAlreadyGeneratedLabel + '
', '
' + this.isDocumentAlreadySentLabel + '
', + '
'+this.totalTtc + '
', '
', ]; return myrow; diff --git a/gestion/templates/content/facture.php b/gestion/templates/content/facture.php index f8ba922..fa023e6 100644 --- a/gestion/templates/content/facture.php +++ b/gestion/templates/content/facture.php @@ -39,6 +39,7 @@ t('Date de paiement'));?> t('Générée'));?> t('Envoyée au client'));?> + t('Total TTC'));?> t('Actions'));?> From 049efcfe2c04ef85a1b49347f02d112ff306b6f3 Mon Sep 17 00:00:00 2001 From: narindraezway Date: Thu, 4 Sep 2025 17:33:52 +0300 Subject: [PATCH 2/2] build --- gestion/js/943.app.js | 1 + gestion/js/apercusTousDevis.app.js | 2 +- gestion/js/apercusToutesFactures.app.js | 2 +- gestion/js/article.app.js | 2 +- gestion/js/bibliotheque.app.js | 2 +- gestion/js/client.app.js | 2 +- gestion/js/clientGroup.app.js | 2 +- gestion/js/clientGroupDiscount.app.js | 2 +- gestion/js/clientGroupFacturation.app.js | 2 +- gestion/js/configuration.app.js | 2 +- gestion/js/defunt.app.js | 2 +- gestion/js/defuntShow.app.js | 2 +- gestion/js/devis.app.js | 2 +- gestion/js/devisShow.app.js | 2 +- gestion/js/facture.app.js | 2 +- gestion/js/factureGroupDetails.app.js | 2 +- gestion/js/factureShow.app.js | 2 +- gestion/js/legalnotice.app.js | 2 +- gestion/js/lieu.app.js | 2 +- gestion/js/pdf.app.js | 2 +- gestion/js/produit.app.js | 2 +- gestion/js/statistique.app.js | 2 +- gestion/js/thanatopracteur.app.js | 2 +- gestion/js/trajet.app.js | 2 +- gestion/js/trajetdetails.app.js | 2 +- 25 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 gestion/js/943.app.js diff --git a/gestion/js/943.app.js b/gestion/js/943.app.js new file mode 100644 index 0000000..a83bdb1 --- /dev/null +++ b/gestion/js/943.app.js @@ -0,0 +1 @@ +(self.webpackChunkgestion=self.webpackChunkgestion||[]).push([[943],{1943:(t,e,i)=>{"use strict";i.r(e),i.d(e,{AElement:()=>oe,AnimateColorElement:()=>te,AnimateElement:()=>Jt,AnimateTransformElement:()=>ee,BoundingBox:()=>Vt,CB1:()=>J,CB2:()=>tt,CB3:()=>et,CB4:()=>it,Canvg:()=>_e,CircleElement:()=>Ft,ClipPathElement:()=>Te,DefsElement:()=>Qt,DescElement:()=>Me,Document:()=>Ve,Element:()=>Ct,EllipseElement:()=>Ut,FeColorMatrixElement:()=>be,FeCompositeElement:()=>Ee,FeDropShadowElement:()=>Ae,FeGaussianBlurElement:()=>Pe,FeMorphologyElement:()=>Ce,FilterElement:()=>we,Font:()=>Nt,FontElement:()=>ne,FontFaceElement:()=>ie,GElement:()=>Gt,GlyphElement:()=>re,GradientElement:()=>$t,ImageElement:()=>ce,LineElement:()=>Ht,LinearGradientElement:()=>Zt,MarkerElement:()=>Wt,MaskElement:()=>ve,Matrix:()=>vt,MissingGlyphElement:()=>se,Mouse:()=>ct,PSEUDO_ZERO:()=>$,Parser:()=>mt,PathElement:()=>Dt,PathParser:()=>Lt,PatternElement:()=>qt,Point:()=>lt,PolygonElement:()=>Yt,PolylineElement:()=>Xt,Property:()=>at,QB1:()=>rt,QB2:()=>st,QB3:()=>nt,RadialGradientElement:()=>jt,RectElement:()=>zt,RenderedElement:()=>_t,Rotate:()=>xt,SVGElement:()=>Bt,SVGFontLoader:()=>ge,Scale:()=>bt,Screen:()=>dt,Skew:()=>St,SkewX:()=>Tt,SkewY:()=>wt,StopElement:()=>Kt,StyleElement:()=>de,SymbolElement:()=>ue,TRefElement:()=>ae,TSpanElement:()=>kt,TextElement:()=>Rt,TextPathElement:()=>he,TitleElement:()=>Oe,Transform:()=>At,Translate:()=>yt,UnknownElement:()=>Et,UseElement:()=>pe,ViewPort:()=>ot,compressSpaces:()=>V,elements:()=>Ne,getSelectorSpecificity:()=>G,normalizeAttributeName:()=>D,normalizeColor:()=>z,parseExternalUrl:()=>B,presets:()=>N,toMatrixValue:()=>I,toNumbers:()=>k,trimLeft:()=>_,trimRight:()=>R,vectorMagnitude:()=>Z,vectorsAngle:()=>K,vectorsRatio:()=>j});var r=i(3146),s=i(2855),n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function o(t,e){var i=t[0],r=t[1];return[i*Math.cos(e)-r*Math.sin(e),i*Math.sin(e)+r*Math.cos(e)]}function h(){for(var t=[],e=0;et.phi1&&(t.phi2-=2*l),1===t.sweepFlag&&t.phi2r)return[];if(0===r)return[[t*i/(t*t+e*e),e*i/(t*t+e*e)]];var s=Math.sqrt(r);return[[(t*i+e*s)/(t*t+e*e),(e*i-t*s)/(t*t+e*e)],[(t*i-e*s)/(t*t+e*e),(e*i+t*s)/(t*t+e*e)]]}var g,d=Math.PI/180;function p(t,e,i){return(1-i)*t+i*e}function f(t,e,i,r){return t+Math.cos(r/180*l)*e+Math.sin(r/180*l)*i}function m(t,e,i,r){var s=1e-6,n=e-t,a=i-e,o=3*n+3*(r-i)-6*a,h=6*(a-n),l=3*n;return Math.abs(o)m&&(s.sweepFlag=+!s.sweepFlag),s}))}t.ROUND=function(t){function e(e){return Math.round(e*t)/t}return void 0===t&&(t=1e13),h(t),function(t){return void 0!==t.x1&&(t.x1=e(t.x1)),void 0!==t.y1&&(t.y1=e(t.y1)),void 0!==t.x2&&(t.x2=e(t.x2)),void 0!==t.y2&&(t.y2=e(t.y2)),void 0!==t.x&&(t.x=e(t.x)),void 0!==t.y&&(t.y=e(t.y)),void 0!==t.rX&&(t.rX=e(t.rX)),void 0!==t.rY&&(t.rY=e(t.rY)),t}},t.TO_ABS=e,t.TO_REL=function(){return s((function(t,e,i){return t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=i),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=i),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=i),t.relative=!0),t}))},t.NORMALIZE_HVZ=function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),s((function(r,s,n,a,o){if(isNaN(a)&&!(r.type&w.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&w.HORIZ_LINE_TO&&(r.type=w.LINE_TO,r.y=r.relative?0:n),i&&r.type&w.VERT_LINE_TO&&(r.type=w.LINE_TO,r.x=r.relative?0:s),t&&r.type&w.CLOSE_PATH&&(r.type=w.LINE_TO,r.x=r.relative?a-s:a,r.y=r.relative?o-n:o),r.type&w.ARC&&(0===r.rX||0===r.rY)&&(r.type=w.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r}))},t.NORMALIZE_ST=i,t.QT_TO_C=r,t.INFO=s,t.SANITIZE=function(t){void 0===t&&(t=0),h(t);var e=NaN,i=NaN,r=NaN,n=NaN;return s((function(s,a,o,h,l){var c=Math.abs,u=!1,g=0,d=0;if(s.type&w.SMOOTH_CURVE_TO&&(g=isNaN(e)?0:a-e,d=isNaN(i)?0:o-i),s.type&(w.CURVE_TO|w.SMOOTH_CURVE_TO)?(e=s.relative?a+s.x2:s.x2,i=s.relative?o+s.y2:s.y2):(e=NaN,i=NaN),s.type&w.SMOOTH_QUAD_TO?(r=isNaN(r)?a:2*a-r,n=isNaN(n)?o:2*o-n):s.type&w.QUAD_TO?(r=s.relative?a+s.x1:s.x1,n=s.relative?o+s.y1:s.y2):(r=NaN,n=NaN),s.type&w.LINE_COMMANDS||s.type&w.ARC&&(0===s.rX||0===s.rY||!s.lArcFlag)||s.type&w.CURVE_TO||s.type&w.SMOOTH_CURVE_TO||s.type&w.QUAD_TO||s.type&w.SMOOTH_QUAD_TO){var p=void 0===s.x?0:s.relative?s.x:s.x-a,f=void 0===s.y?0:s.relative?s.y:s.y-o;g=isNaN(r)?void 0===s.x1?g:s.relative?s.x:s.x1-a:r-a,d=isNaN(n)?void 0===s.y1?d:s.relative?s.y:s.y1-o:n-o;var m=void 0===s.x2?0:s.relative?s.x:s.x2-a,y=void 0===s.y2?0:s.relative?s.y:s.y2-o;c(p)<=t&&c(f)<=t&&c(g)<=t&&c(d)<=t&&c(m)<=t&&c(y)<=t&&(u=!0)}return s.type&w.CLOSE_PATH&&c(a-h)<=t&&c(o-l)<=t&&(u=!0),u?[]:s}))},t.MATRIX=n,t.ROTATE=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),h(t,e,i);var r=Math.sin(t),s=Math.cos(t);return n(s,r,-r,s,e-e*s+i*r,i-e*r-i*s)},t.TRANSLATE=function(t,e){return void 0===e&&(e=0),h(t,e),n(1,0,0,1,t,e)},t.SCALE=function(t,e){return void 0===e&&(e=t),h(t,e),n(t,0,0,e,0,0)},t.SKEW_X=function(t){return h(t),n(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return h(t),n(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),h(t),n(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),h(t),n(1,0,0,-1,0,t)},t.A_TO_C=function(){return s((function(t,e,i){return w.ARC===t.type?function(t,e,i){var r,s,n,a;t.cX||c(t,e,i);for(var h=Math.min(t.phi1,t.phi2),l=Math.max(t.phi1,t.phi2)-h,u=Math.ceil(l/90),g=new Array(u),f=e,m=i,y=0;yo.maxX&&(o.maxX=t),to.maxY&&(o.maxY=t),tR&&h(y(i,s.x1,s.x2,s.x,R));for(var p=0,x=m(r,s.y1,s.y2,s.y);pR&&l(y(r,s.y1,s.y2,s.y,R))}if(s.type&w.ARC){h(s.x),l(s.y),c(s,i,r);for(var b=s.xRot/180*Math.PI,v=Math.cos(b)*s.rX,S=Math.sin(b)*s.rX,T=-Math.sin(b)*s.rY,A=Math.cos(b)*s.rY,C=s.phi1s.phi2?[s.phi2+360,s.phi1+360]:[s.phi2,s.phi1],E=C[0],P=C[1],O=function(t){var e=t[0],i=t[1],r=180*Math.atan2(i,e)/Math.PI;return rE&&RE&&Rh)throw new SyntaxError('Expected positive number, got "'+h+'" at index "'+s+'"')}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+s+'"');this.curArgs.push(h),this.curArgs.length===A[this.curCommandType]&&(w.HORIZ_LINE_TO===this.curCommandType?r({type:w.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):w.VERT_LINE_TO===this.curCommandType?r({type:w.VERT_LINE_TO,relative:this.curCommandRelative,y:h}):this.curCommandType===w.MOVE_TO||this.curCommandType===w.LINE_TO||this.curCommandType===w.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),w.MOVE_TO===this.curCommandType&&(this.curCommandType=w.LINE_TO)):this.curCommandType===w.CURVE_TO?r({type:w.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===w.SMOOTH_CURVE_TO?r({type:w.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===w.QUAD_TO?r({type:w.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===w.ARC&&r({type:w.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!v(n))if(","===n&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==n&&"-"!==n&&"."!==n)if(o)this.curNumber=n,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+s+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==n&&"Z"!==n)if("h"===n||"H"===n)this.curCommandType=w.HORIZ_LINE_TO,this.curCommandRelative="h"===n;else if("v"===n||"V"===n)this.curCommandType=w.VERT_LINE_TO,this.curCommandRelative="v"===n;else if("m"===n||"M"===n)this.curCommandType=w.MOVE_TO,this.curCommandRelative="m"===n;else if("l"===n||"L"===n)this.curCommandType=w.LINE_TO,this.curCommandRelative="l"===n;else if("c"===n||"C"===n)this.curCommandType=w.CURVE_TO,this.curCommandRelative="c"===n;else if("s"===n||"S"===n)this.curCommandType=w.SMOOTH_CURVE_TO,this.curCommandRelative="s"===n;else if("q"===n||"Q"===n)this.curCommandType=w.QUAD_TO,this.curCommandRelative="q"===n;else if("t"===n||"T"===n)this.curCommandType=w.SMOOTH_QUAD_TO,this.curCommandRelative="t"===n;else{if("a"!==n&&"A"!==n)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+".");this.curCommandType=w.ARC,this.curCommandRelative="a"===n}else e.push({type:w.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=n,this.curNumberHasDecimal="."===n}else this.curNumber+=n,this.curNumberHasDecimal=!0;else this.curNumber+=n;else this.curNumber+=n,this.curNumberHasExp=!0;else this.curNumber+=n,this.curNumberHasExpDigits=this.curNumberHasExp}return e},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(e,i){void 0===i&&(i=[]);for(var r=0,s=Object.getPrototypeOf(this).parse.call(this,e);r>S;if(o[b+3]=j,0!==j){var K=255/j;o[b]=(z*v>>S)*K,o[b+1]=(F*v>>S)*K,o[b+2]=(U*v>>S)*K}else o[b]=o[b+1]=o[b+2]=0;z-=I,F-=L,U-=D,H-=B,I-=m.r,L-=m.g,D-=m.b,B-=m.a;var J=Z+n+1;J=x+(J>S,lt>0?(lt=255/lt,o[Pt]=(pt*v>>S)*lt,o[Pt+1]=(ft*v>>S)*lt,o[Pt+2]=(mt*v>>S)*lt):o[Pt]=o[Pt+1]=o[Pt+2]=0,pt-=ct,ft-=ut,mt-=gt,yt-=dt,ct-=m.r,ut-=m.g,gt-=m.b,dt-=m.a,Pt=nt+((Pt=Et+u)0&&void 0!==arguments[0]?arguments[0]:{};const e={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:t,createCanvas:(t,e)=>new OffscreenCanvas(t,e),async createImage(t){const e=await fetch(t),i=await e.blob();return await createImageBitmap(i)}};return void 0===globalThis.DOMParser&&void 0!==t||Reflect.deleteProperty(e,"DOMParser"),e},node:function(t){let{DOMParser:e,canvas:i,fetch:r}=t;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,fetch:r,createCanvas:i.createCanvas,createImage:i.loadImage}}});function V(t){return t.replace(/(?!\u3000)\s+/gm," ")}function _(t){return t.replace(/^[\n \t]+/,"")}function R(t){return t.replace(/[\n \t]+$/,"")}function k(t){const e=t.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return e?e.map(parseFloat):[]}function I(t){const e=k(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||0,e[4]||0,e[5]||0]}const L=/^[A-Z-]+$/;function D(t){return L.test(t)?t.toLowerCase():t}function B(t){const e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(t);return e&&(e[2]||e[3]||e[4])||""}function z(t){if(!t.startsWith("rgb"))return t;let e=3;return t.replace(/\d+(\.\d+)?/g,((t,i)=>e--&&i?String(Math.round(parseFloat(t))):t))}const F=/(\[[^\]]+\])/g,U=/(#[^\s+>~.[:]+)/g,H=/(\.[^\s+>~.[:]+)/g,X=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,Y=/(:[\w-]+\([^)]*\))/gi,q=/(:[^\s+>~.[:]+)/g,W=/([^\s+>~.[:]+)/g;function Q(t,e){const i=e.exec(t);return i?[t.replace(e," "),i.length]:[t,0]}function G(t){const e=[0,0,0];let i=t.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),r=0;return[i,r]=Q(i,F),e[1]+=r,[i,r]=Q(i,U),e[0]+=r,[i,r]=Q(i,H),e[1]+=r,[i,r]=Q(i,X),e[2]+=r,[i,r]=Q(i,Y),e[1]+=r,[i,r]=Q(i,q),e[1]+=r,i=i.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[i,r]=Q(i,W),e[2]+=r,e.join("")}const $=1e-8;function Z(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function j(t,e){return(t[0]*e[0]+t[1]*e[1])/(Z(t)*Z(e))}function K(t,e){return(t[0]*e[1]0&&void 0!==arguments[0]?arguments[0]:" ";const{document:e,name:i}=this;return V(this.getString()).trim().split(t).map((t=>new at(e,i,t)))}hasValue(t){const e=this.value;return null!==e&&""!==e&&(t||0!==e)&&void 0!==e}isString(t){const{value:e}=this,i="string"==typeof e;return i&&t?t.test(e):i}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const t=this.getString();switch(!0){case t.endsWith("px"):case/^[0-9]+$/.test(t):return!0;default:return!1}}setValue(t){return this.value=t,this}getValue(t){return void 0===t||this.hasValue()?this.value:t}getNumber(t){if(!this.hasValue())return void 0===t?0:parseFloat(t);const{value:e}=this;let i=parseFloat(e);return this.isString(/%$/)&&(i/=100),i}getString(t){return void 0===t||this.hasValue()?void 0===this.value?"":String(this.value):String(t)}getColor(t){let e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=z(e),this.value=e),e}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;const[i,r]="boolean"==typeof t?[void 0,t]:[t],{viewPort:s}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(s.computeSize("x"),s.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(s.computeSize("x"),s.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*s.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*s.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return 15*this.getNumber();case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case this.isString(/%$/)&&r:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*s.computeSize(i);default:{const t=this.getNumber();return e&&t<1?t*s.computeSize(i):t}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){const t=this.getString(),e=/#([^)'"]+)/.exec(t),i=(null==e?void 0:e[1])||t;return this.document.definitions[i]}getFillStyleDefinition(t,e){let i=this.getDefinition();if(!i)return null;if("function"==typeof i.createGradient&&"getBoundingBox"in t)return i.createGradient(this.document.ctx,t,e);if("function"==typeof i.createPattern){if(i.getHrefAttribute().hasValue()){const t=i.getAttribute("patternTransform");i=i.getHrefAttribute().getDefinition(),i&&t.hasValue()&&i.getAttribute("patternTransform",!0).setValue(t.value)}if(i)return i.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){if(!this.hasValue())return null;const t=this.getString();return at.textBaselineMapping[t]||null}addOpacity(t){let e=this.getColor();const i=e.length;let r=0;for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:0;const[i=e,r=e]=k(t);return new lt(i,r)}static parseScale(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const[i=e,r=i]=k(t);return new lt(i,r)}static parsePath(t){const e=k(t),i=e.length,r=[];for(let t=0;t0}runEvents(){if(!this.working)return;const{screen:t,events:e,eventElements:i}=this,{style:r}=t.ctx.canvas;let s;r&&(r.cursor=""),e.forEach(((t,e)=>{let{run:r}=t;for(s=i[e];s;)r(s),s=s.parent})),this.events=[],this.eventElements=[]}checkPath(t,e){if(!this.working||!e)return;const{events:i,eventElements:r}=this;i.forEach(((i,s)=>{let{x:n,y:a}=i;!r[s]&&e.isPointInPath&&e.isPointInPath(n,a)&&(r[s]=t)}))}checkBoundingBox(t,e){if(!this.working||!e)return;const{events:i,eventElements:r}=this;i.forEach(((i,s)=>{let{x:n,y:a}=i;!r[s]&&e.isPointInBox(n,a)&&(r[s]=t)}))}mapXY(t,e){const{window:i,ctx:r}=this.screen,s=new lt(t,e);let n=r.canvas;for(;n;)s.x-=n.offsetLeft,s.y-=n.offsetTop,n=n.offsetParent;return(null==i?void 0:i.scrollX)&&(s.x+=i.scrollX),(null==i?void 0:i.scrollY)&&(s.y+=i.scrollY),s}onClick(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onclick",x:e,y:i,run(t){t.onClick&&t.onClick()}})}onMouseMove(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onmousemove",x:e,y:i,run(t){t.onMouseMove&&t.onMouseMove()}})}constructor(t){this.screen=t,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const ut="undefined"!=typeof window?window:null,gt="undefined"!=typeof fetch?fetch.bind(void 0):void 0;class dt{wait(t){this.waits.push(t)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const t=this.waits.every((t=>t()));return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}setDefaults(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}setViewBox(t){let{document:e,ctx:i,aspectRatio:r,width:s,desiredWidth:n,height:a,desiredHeight:o,minX:h=0,minY:l=0,refX:c,refY:u,clip:g=!1,clipX:d=0,clipY:p=0}=t;const f=V(r).replace(/^defer\s/,""),[m,y]=f.split(" "),x=m||"xMidYMid",b=y||"meet",v=s/n,S=a/o,T=Math.min(v,S),w=Math.max(v,S);let A=n,C=o;"meet"===b&&(A*=T,C*=T),"slice"===b&&(A*=w,C*=w);const E=new at(e,"refX",c),P=new at(e,"refY",u),O=E.hasValue()&&P.hasValue();if(O&&i.translate(-T*E.getPixels("x"),-T*P.getPixels("y")),g){const t=T*d,e=T*p;i.beginPath(),i.moveTo(t,e),i.lineTo(s,e),i.lineTo(s,a),i.lineTo(t,a),i.closePath(),i.clip()}if(!O){const t="meet"===b&&T===S,e="slice"===b&&w===S,r="meet"===b&&T===v,n="slice"===b&&w===v;x.startsWith("xMid")&&(t||e)&&i.translate(s/2-A/2,0),x.endsWith("YMid")&&(r||n)&&i.translate(0,a/2-C/2),x.startsWith("xMax")&&(t||e)&&i.translate(s-A,0),x.endsWith("YMax")&&(r||n)&&i.translate(0,a-C)}switch(!0){case"none"===x:i.scale(v,S);break;case"meet"===b:i.scale(T,T);break;case"slice"===b:i.scale(w,w)}i.translate(-h,-l)}start(t){let{enableRedraw:e=!1,ignoreMouse:i=!1,ignoreAnimation:s=!1,ignoreDimensions:n=!1,ignoreClear:a=!1,forceRedraw:o,scaleWidth:h,scaleHeight:l,offsetX:c,offsetY:u}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{mouse:g}=this,d=1e3/dt.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=d,this.readyPromise=new Promise((t=>{this.resolveReady=t})),this.isReady()&&this.render(t,n,a,h,l,c,u),!e)return;let p=Date.now(),f=p,m=0;const y=()=>{p=Date.now(),m=p-f,m>=d&&(f=p-m%d,this.shouldUpdate(s,o)&&(this.render(t,n,a,h,l,c,u),g.runEvents())),this.intervalId=r(y)};i||g.start(),this.intervalId=r(y)}stop(){this.intervalId&&(r.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){const{frameDuration:t}=this;if(this.animations.reduce(((e,i)=>i.update(t)||e),!1))return!0}return!("function"!=typeof e||!e())||!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents()}render(t,e,i,r,s,n,a){const{viewPort:o,ctx:h,isFirstRender:l}=this,c=h.canvas;o.clear(),c.width&&c.height&&o.setCurrent(c.width,c.height);const u=t.getStyle("width"),g=t.getStyle("height");!e&&(l||"number"!=typeof r&&"number"!=typeof s)&&(u.hasValue()&&(c.width=u.getPixels("x"),c.style&&(c.style.width="".concat(c.width,"px"))),g.hasValue()&&(c.height=g.getPixels("y"),c.style&&(c.style.height="".concat(c.height,"px"))));let d=c.clientWidth||c.width,p=c.clientHeight||c.height;if(e&&u.hasValue()&&g.hasValue()&&(d=u.getPixels("x"),p=g.getPixels("y")),o.setCurrent(d,p),"number"==typeof n&&t.getAttribute("x",!0).setValue(n),"number"==typeof a&&t.getAttribute("y",!0).setValue(a),"number"==typeof r||"number"==typeof s){const e=k(t.getAttribute("viewBox").getString());let i=0,n=0;if("number"==typeof r){const s=t.getStyle("width");s.hasValue()?i=s.getPixels("x")/r:e[2]&&!isNaN(e[2])&&(i=e[2]/r)}if("number"==typeof s){const i=t.getStyle("height");i.hasValue()?n=i.getPixels("y")/s:e[3]&&!isNaN(e[3])&&(n=e[3]/s)}i||(i=n),n||(n=i),t.getAttribute("width",!0).setValue(r),t.getAttribute("height",!0).setValue(s);const a=t.getStyle("transform",!0,!0);a.setValue("".concat(a.getString()," scale(").concat(1/i,", ").concat(1/n,")"))}i||h.clearRect(0,0,d,p),t.render(h),l&&(this.isFirstRender=!1)}constructor(t,{fetch:e=gt,window:i=ut}={}){if(this.ctx=t,this.viewPort=new ot,this.mouse=new ct(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=i,!e)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=e}}dt.defaultWindow=ut,dt.defaultFetch=gt,dt.FRAMERATE=30,dt.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:pt}=dt,ft="undefined"!=typeof DOMParser?DOMParser:void 0;class mt{async parse(t){return t.startsWith("<")?this.parseFromString(t):this.load(t)}parseFromString(t){const e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch(i){return this.checkDocument(e.parseFromString(t,"text/xml"))}}checkDocument(t){const e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent||"Unknown parse error");return t}async load(t){const e=await this.fetch(t),i=await e.text();return this.parseFromString(i)}constructor({fetch:t=pt,DOMParser:e=ft}={}){if(!t)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!e)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=t,this.DOMParser=e}}class yt{apply(t){const{x:e,y:i}=this.point;t.translate(e||0,i||0)}unapply(t){const{x:e,y:i}=this.point;t.translate(-1*e||0,-1*i||0)}applyToPoint(t){const{x:e,y:i}=this.point;t.applyTransform([1,0,0,1,e||0,i||0])}constructor(t,e){this.type="translate",this.point=lt.parse(e)}}class xt{apply(t){const{cx:e,cy:i,originX:r,originY:s,angle:n}=this,a=e+r.getPixels("x"),o=i+s.getPixels("y");t.translate(a,o),t.rotate(n.getRadians()),t.translate(-a,-o)}unapply(t){const{cx:e,cy:i,originX:r,originY:s,angle:n}=this,a=e+r.getPixels("x"),o=i+s.getPixels("y");t.translate(a,o),t.rotate(-1*n.getRadians()),t.translate(-a,-o)}applyToPoint(t){const{cx:e,cy:i,angle:r}=this,s=r.getRadians();t.applyTransform([1,0,0,1,e||0,i||0]),t.applyTransform([Math.cos(s),Math.sin(s),-Math.sin(s),Math.cos(s),0,0]),t.applyTransform([1,0,0,1,-e||0,-i||0])}constructor(t,e,i){this.type="rotate";const r=k(e);this.angle=new at(t,"angle",r[0]),this.originX=i[0],this.originY=i[1],this.cx=r[1]||0,this.cy=r[2]||0}}class bt{apply(t){const{scale:{x:e,y:i},originX:r,originY:s}=this,n=r.getPixels("x"),a=s.getPixels("y");t.translate(n,a),t.scale(e,i||e),t.translate(-n,-a)}unapply(t){const{scale:{x:e,y:i},originX:r,originY:s}=this,n=r.getPixels("x"),a=s.getPixels("y");t.translate(n,a),t.scale(1/e,1/i||e),t.translate(-n,-a)}applyToPoint(t){const{x:e,y:i}=this.scale;t.applyTransform([e||0,0,0,i||0,0,0])}constructor(t,e,i){this.type="scale";const r=lt.parseScale(e);0!==r.x&&0!==r.y||(r.x=$,r.y=$),this.scale=r,this.originX=i[0],this.originY=i[1]}}class vt{apply(t){const{originX:e,originY:i,matrix:r}=this,s=e.getPixels("x"),n=i.getPixels("y");t.translate(s,n),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),t.translate(-s,-n)}unapply(t){const{originX:e,originY:i,matrix:r}=this,s=r[0],n=r[2],a=r[4],o=r[1],h=r[3],l=r[5],c=1/(s*(1*h-0*l)-n*(1*o-0*l)+a*(0*o-0*h)),u=e.getPixels("x"),g=i.getPixels("y");t.translate(u,g),t.transform(c*(1*h-0*l),c*(0*l-1*o),c*(0*a-1*n),c*(1*s-0*a),c*(n*l-a*h),c*(a*o-s*l)),t.translate(-u,-g)}applyToPoint(t){t.applyTransform(this.matrix)}constructor(t,e,i){this.type="matrix",this.matrix=I(e),this.originX=i[0],this.originY=i[1]}}class St extends vt{constructor(t,e,i){super(t,e,i),this.type="skew",this.angle=new at(t,"angle",e)}}class Tt extends St{constructor(t,e,i){super(t,e,i),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class wt extends St{constructor(t,e,i){super(t,e,i),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}class At{static fromElement(t,e){const i=e.getStyle("transform",!1,!0);if(i.hasValue()){const[r,s=r]=e.getStyle("transform-origin",!1,!0).split();if(r&&s){const e=[r,s];return new At(t,i.getString(),e)}}return null}apply(t){this.transforms.forEach((e=>e.apply(t)))}unapply(t){this.transforms.forEach((e=>e.unapply(t)))}applyToPoint(t){this.transforms.forEach((e=>e.applyToPoint(t)))}constructor(t,e,i){this.document=t,this.transforms=[],V(e).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/).forEach((t=>{if("none"===t)return;const[e,r]=function(t){const[e="",i=""]=t.split("(");return[e.trim(),i.trim().replace(")","")]}(t),s=At.transformTypes[e];s&&this.transforms.push(new s(this.document,r,i))}))}}At.transformTypes={translate:yt,rotate:xt,scale:bt,matrix:vt,skewX:Tt,skewY:wt};class Ct{getAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.attributes[t];if(!i&&e){const e=new at(this.document,t,"");return this.attributes[t]=e,e}return i||at.empty(this.document)}getHrefAttribute(){let t;for(const e in this.attributes)if("href"===e||e.endsWith(":href")){t=this.attributes[e];break}return t||at.empty(this.document)}getStyle(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.styles[t];if(r)return r;const s=this.getAttribute(t);if(s.hasValue())return this.styles[t]=s,s;if(!i){const{parent:e}=this;if(e){const i=e.getStyle(t);if(i.hasValue())return i}}if(e){const e=new at(this.document,t,"");return this.styles[t]=e,e}return at.empty(this.document)}render(t){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(t.save(),this.getStyle("mask").hasValue()){const e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if("none"!==this.getStyle("filter").getValue("none")){const e=this.getStyle("filter").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}setContext(t){}applyEffects(t){const e=At.fromElement(this.document,this);e&&e.apply(t);const i=this.getStyle("clip-path",!1,!0);if(i.hasValue()){const e=i.getDefinition();e&&e.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach((e=>{e.render(t)}))}addChild(t){const e=t instanceof Ct?t:this.document.createElement(t);e.parent=this,Ct.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e;const{node:i}=this;if("function"==typeof i.matches)return i.matches(t);const r=null===(e=i.getAttribute)||void 0===e?void 0:e.call(i,"class");return!(!r||""===r)&&r.split(" ").some((e=>".".concat(e)===t))}addStylesFromStyleDefinition(){const{styles:t,stylesSpecificity:e}=this.document;let i;for(const r in t)if(!r.startsWith("@")&&this.matchesSelector(r)){const s=t[r],n=e[r];if(s)for(const t in s){let e=this.stylesSpecificity[t];void 0===e&&(e="000"),n&&n>=e&&(i=s[t],i&&(this.styles[t]=i),this.stylesSpecificity[t]=n)}}}removeStyles(t,e){return e.reduce(((e,i)=>{const r=t.getStyle(i);if(!r.hasValue())return e;const s=r.getString();return r.setValue(""),[...e,[i,s]]}),[])}restoreStyles(t,e){e.forEach((e=>{let[i,r]=e;t.getStyle(i,!0).setValue(r)}))}isFirstChild(){var t;return 0===(null===(t=this.parent)||void 0===t?void 0:t.children.indexOf(this))}constructor(t,e,i=!1){if(this.document=t,this.node=e,this.captureTextNodes=i,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!e||1!==e.nodeType)return;if(Array.from(e.attributes).forEach((e=>{const i=D(e.nodeName);this.attributes[i]=new at(t,i,e.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()){const e=this.getAttribute("style").getString().split(";").map((t=>t.trim()));e.forEach((e=>{if(!e)return;const[i,r]=e.split(":").map((t=>t.trim()));i&&(this.styles[i]=new at(t,i,r))}))}const{definitions:r}=t,s=this.getAttribute("id");s.hasValue()&&(r[s.getString()]||(r[s.getString()]=this)),Array.from(e.childNodes).forEach((e=>{if(1===e.nodeType)this.addChild(e);else if(i&&(3===e.nodeType||4===e.nodeType)){const i=t.createTextNode(e);i.getText().length>0&&this.addChild(i)}}))}}Ct.ignoreChildTypes=["title"];class Et extends Ct{constructor(t,e,i){super(t,e,i)}}function Pt(t){const e=t.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function Ot(t){if(!t)return"";const e=t.trim().toLowerCase();switch(e){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return e;default:return/^oblique\s+(-|)\d+deg$/.test(e)?e:""}}function Mt(t){if(!t)return"";const e=t.trim().toLowerCase();switch(e){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return e;default:return/^[\d.]+$/.test(e)?e:""}}class Nt{static parse(){let t=arguments.length>1?arguments[1]:void 0,e="",i="",r="",s="",n="";const a=V(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split(" "),o={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach((t=>{switch(!0){case!o.fontStyle&&Nt.styles.includes(t):"inherit"!==t&&(e=t),o.fontStyle=!0;break;case!o.fontVariant&&Nt.variants.includes(t):"inherit"!==t&&(i=t),o.fontStyle=!0,o.fontVariant=!0;break;case!o.fontWeight&&Nt.weights.includes(t):"inherit"!==t&&(r=t),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0;break;case!o.fontSize:"inherit"!==t&&(s=t.split("/")[0]||""),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0,o.fontSize=!0;break;default:"inherit"!==t&&(n+=t)}})),new Nt(e,i,r,s,n,t)}toString(){return[Ot(this.fontStyle),this.fontVariant,Mt(this.fontWeight),this.fontSize,(t=this.fontFamily,"undefined"==typeof process?t:t.trim().split(",").map(Pt).join(","))].join(" ").trim();var t}constructor(t,e,i,r,s,n){const a=n?"string"==typeof n?Nt.parse(n):n:{};this.fontFamily=s||a.fontFamily,this.fontSize=r||a.fontSize,this.fontStyle=t||a.fontStyle,this.fontWeight=i||a.fontWeight,this.fontVariant=e||a.fontVariant}}Nt.styles="normal|italic|oblique|inherit",Nt.variants="normal|small-caps|inherit",Nt.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class Vt{get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(t,e){void 0!==t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),tthis.x2&&(this.x2=t)),void 0!==e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))}addX(t){this.addPoint(t,0)}addY(t){this.addPoint(0,t)}addBoundingBox(t){if(!t)return;const{x1:e,y1:i,x2:r,y2:s}=t;this.addPoint(e,i),this.addPoint(r,s)}sumCubic(t,e,i,r,s){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*i+3*(1-t)*Math.pow(t,2)*r+Math.pow(t,3)*s}bezierCurveAdd(t,e,i,r,s){const n=6*e-12*i+6*r,a=-3*e+9*i-9*r+3*s,o=3*i-3*e;if(0===a){if(0===n)return;const a=-o/n;return void(01&&void 0!==arguments[1]&&arguments[1];if(!e){const e=this.getStyle("fill"),i=this.getStyle("fill-opacity"),r=this.getStyle("stroke"),s=this.getStyle("stroke-opacity");if(e.isUrlDefinition()){const r=e.getFillStyleDefinition(this,i);r&&(t.fillStyle=r)}else if(e.hasValue()){"currentColor"===e.getString()&&e.setValue(this.getStyle("color").getColor());const i=e.getColor();"inherit"!==i&&(t.fillStyle="none"===i?"rgba(0,0,0,0)":i)}if(i.hasValue()){const e=new at(this.document,"fill",t.fillStyle).addOpacity(i).getColor();t.fillStyle=e}if(r.isUrlDefinition()){const e=r.getFillStyleDefinition(this,s);e&&(t.strokeStyle=e)}else if(r.hasValue()){"currentColor"===r.getString()&&r.setValue(this.getStyle("color").getColor());const e=r.getString();"inherit"!==e&&(t.strokeStyle="none"===e?"rgba(0,0,0,0)":e)}if(s.hasValue()){const e=new at(this.document,"stroke",t.strokeStyle).addOpacity(s).getString();t.strokeStyle=e}const n=this.getStyle("stroke-width");if(n.hasValue()){const e=n.getPixels();t.lineWidth=e||$}const a=this.getStyle("stroke-linecap"),o=this.getStyle("stroke-linejoin"),h=this.getStyle("stroke-miterlimit"),l=this.getStyle("stroke-dasharray"),c=this.getStyle("stroke-dashoffset");if(a.hasValue()&&(t.lineCap=a.getString()),o.hasValue()&&(t.lineJoin=o.getString()),h.hasValue()&&(t.miterLimit=h.getNumber()),l.hasValue()&&"none"!==l.getString()){const e=k(l.getString());void 0!==t.setLineDash?t.setLineDash(e):void 0!==t.webkitLineDash?t.webkitLineDash=e:void 0===t.mozDash||1===e.length&&0===e[0]||(t.mozDash=e);const i=c.getPixels();void 0!==t.lineDashOffset?t.lineDashOffset=i:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=i:void 0!==t.mozDashOffset&&(t.mozDashOffset=i)}}if(this.modifiedEmSizeStack=!1,void 0!==t.font){const e=this.getStyle("font"),i=this.getStyle("font-style"),r=this.getStyle("font-variant"),s=this.getStyle("font-weight"),n=this.getStyle("font-size"),a=this.getStyle("font-family"),o=new Nt(i.getString(),r.getString(),s.getString(),n.hasValue()?"".concat(n.getPixels(!0),"px"):"",a.getString(),Nt.parse(e.getString(),t.font));i.setValue(o.fontStyle),r.setValue(o.fontVariant),s.setValue(o.fontWeight),n.setValue(o.fontSize),a.setValue(o.fontFamily),t.font=o.toString(),n.isPixels()&&(this.document.emSize=n.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}clearContext(t){super.clearContext(t),this.modifiedEmSizeStack&&this.document.popEmSize()}constructor(...t){super(...t),this.modifiedEmSizeStack=!1}}class Rt extends _t{setContext(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.setContext(t,e);const i=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();i&&(t.textBaseline=i)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(t){if("text"!==this.type)return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);let e=null;return this.children.forEach(((i,r)=>{const s=this.getChildBoundingBox(t,this,this,r);e?e.addBoundingBox(s):e=s})),e}getFontSize(){const{document:t,parent:e}=this,i=Nt.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(i)}getTElementBoundingBox(t){const e=this.getFontSize();return new Vt(this.x,this.y-e,this.x+this.measureText(t),this.y)}getGlyph(t,e,i){const r=e[i];let s;if(t.isArabic){var n;const a=e.length,o=e[i-1],h=e[i+1];let l="isolated";(0===i||" "===o)&&i0&&" "!==o&&i0&&" "!==o&&(i===a-1||" "===h)&&(l="initial"),s=(null===(n=t.arabicGlyphs[r])||void 0===n?void 0:n[l])||t.glyphs[r]}else s=t.glyphs[r];return s||(s=t.missingGlyph),s}getText(){return""}getTextFromNode(t){const e=t||this.node,i=Array.from(e.parentNode.childNodes),r=i.indexOf(e),s=i.length-1;let n=V(e.textContent||"");return 0===r&&(n=_(n)),r===s&&(n=R(n)),n}renderChildren(t){if("text"!==this.type)return void this.renderTElementChildren(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach(((e,i)=>{this.renderChild(t,this,this,i)}));const{mouse:e}=this.document.screen;e.isWorking()&&e.checkBoundingBox(this,this.getBoundingBox(t))}renderTElementChildren(t){const{document:e,parent:i}=this,r=this.getText(),s=i.getStyle("font-family").getDefinition();if(s){const{unitsPerEm:n}=s.fontFace,a=Nt.parse(e.ctx.font),o=i.getStyle("font-size").getNumber(a.fontSize),h=i.getStyle("font-style").getString(a.fontStyle),l=o/n,c=s.isRTL?r.split("").reverse().join(""):r,u=k(i.getAttribute("dx").getString()),g=c.length;for(let e=0;e=this.leafTexts.length)return;const t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start");let i=0;i="start"===e?t.x-this.minX:"end"===e?t.x-this.maxX:t.x-(this.minX+this.maxX)/2;for(let t=this.textChunkStart;t{this.adjustChildCoordinatesRecursiveCore(t,this,this,i)})),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(t,e,i,r){const s=i.children[r];s.children.length>0?s.children.forEach(((i,r)=>{e.adjustChildCoordinatesRecursiveCore(t,e,s,r)})):this.adjustChildCoordinates(t,e,i,r)}adjustChildCoordinates(t,e,i,r){const s=i.children[r];if("function"!=typeof s.measureText)return s;t.save(),s.setContext(t,!0);const n=s.getAttribute("x"),a=s.getAttribute("y"),o=s.getAttribute("dx"),h=s.getAttribute("dy"),l=s.getStyle("font-family").getDefinition(),c=Boolean(null==l?void 0:l.isRTL);0===r&&(n.hasValue()||n.setValue(s.getInheritedAttribute("x")),a.hasValue()||a.setValue(s.getInheritedAttribute("y")),o.hasValue()||o.setValue(s.getInheritedAttribute("dx")),h.hasValue()||h.setValue(s.getInheritedAttribute("dy")));const u=s.measureText(t);return c&&(e.x-=u),n.hasValue()?(e.applyAnchoring(),s.x=n.getPixels("x"),o.hasValue()&&(s.x+=o.getPixels("x"))):(o.hasValue()&&(e.x+=o.getPixels("x")),s.x=e.x),e.x=s.x,c||(e.x+=u),a.hasValue()?(s.y=a.getPixels("y"),h.hasValue()&&(s.y+=h.getPixels("y"))):(h.hasValue()&&(e.y+=h.getPixels("y")),s.y=e.y),e.y=s.y,e.leafTexts.push(s),e.minX=Math.min(e.minX,s.x,s.x+u),e.maxX=Math.max(e.maxX,s.x,s.x+u),s.clearContext(t),t.restore(),s}getChildBoundingBox(t,e,i,r){const s=i.children[r];if("function"!=typeof s.getBoundingBox)return null;const n=s.getBoundingBox(t);return n&&s.children.forEach(((i,r)=>{const a=e.getChildBoundingBox(t,e,s,r);n.addBoundingBox(a)})),n}renderChild(t,e,i,r){const s=i.children[r];s.render(t),s.children.forEach(((i,r)=>{e.renderChild(t,e,s,r)}))}measureText(t){const{measureCache:e}=this;if(~e)return e;const i=this.getText(),r=this.measureTargetText(t,i);return this.measureCache=r,r}measureTargetText(t,e){if(!e.length)return 0;const{parent:i}=this,r=i.getStyle("font-family").getDefinition();if(r){const t=this.getFontSize(),s=r.isRTL?e.split("").reverse().join(""):e,n=k(i.getAttribute("dx").getString()),a=s.length;let o=0;for(let e=0;e0?"":this.getTextFromNode()}}class It extends kt{constructor(...t){super(...t),this.type="textNode"}}class Lt extends w{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new lt(0,0),this.control=new lt(0,0),this.current=new lt(0,0),this.points=[],this.angles=[]}isEnd(){const{i:t,commands:e}=this;return t>=e.length-1}next(){const t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}getPoint(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y";const i=new lt(this.command[t],this.command[e]);return this.makeAbsolute(i)}getAsControlPoint(t,e){const i=this.getPoint(t,e);return this.control=i,i}getAsCurrentPoint(t,e){const i=this.getPoint(t,e);return this.current=i,i}getReflectedControlPoint(){const t=this.previousCommand.type;if(t!==w.CURVE_TO&&t!==w.SMOOTH_CURVE_TO&&t!==w.QUAD_TO&&t!==w.SMOOTH_QUAD_TO)return this.current;const{current:{x:e,y:i},control:{x:r,y:s}}=this;return new lt(2*e-r,2*i-s)}makeAbsolute(t){if(this.command.relative){const{x:e,y:i}=this.current;t.x+=e,t.y+=i}return t}addMarker(t,e,i){const{points:r,angles:s}=this;i&&s.length>0&&!s[s.length-1]&&(s[s.length-1]=r[r.length-1].angleTo(i)),this.addMarkerAngle(t,e?e.angleTo(t):null)}addMarkerAngle(t,e){this.points.push(t),this.angles.push(e)}getMarkerPoints(){return this.points}getMarkerAngles(){const{angles:t}=this,e=t.length;for(let i=0;i[t,i[e]]));return r}renderChildren(t){this.path(t),this.document.screen.mouse.checkPath(this,t);const e=this.getStyle("fill-rule");""!==t.fillStyle&&("inherit"!==e.getString("inherit")?t.fill(e.getString()):t.fill()),""!==t.strokeStyle&&("non-scaling-stroke"===this.getAttribute("vector-effect").getString()?(t.save(),t.setTransform(1,0,0,1,0,0),t.stroke(),t.restore()):t.stroke());const i=this.getMarkers();if(i){const e=i.length-1,r=this.getStyle("marker-start"),s=this.getStyle("marker-mid"),n=this.getStyle("marker-end");if(r.isUrlDefinition()){const e=r.getDefinition(),[s,n]=i[0];e.render(t,s,n)}if(s.isUrlDefinition()){const r=s.getDefinition();for(let s=1;s1&&(r*=Math.sqrt(u),s*=Math.sqrt(u));let g=(a===o?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(s,2)-Math.pow(r,2)*Math.pow(c.y,2)-Math.pow(s,2)*Math.pow(c.x,2))/(Math.pow(r,2)*Math.pow(c.y,2)+Math.pow(s,2)*Math.pow(c.x,2)));isNaN(g)&&(g=0);const d=new lt(g*r*c.y/s,g*-s*c.x/r),p=new lt((e.x+l.x)/2+Math.cos(h)*d.x-Math.sin(h)*d.y,(e.y+l.y)/2+Math.sin(h)*d.x+Math.cos(h)*d.y),f=K([1,0],[(c.x-d.x)/r,(c.y-d.y)/s]),m=[(c.x-d.x)/r,(c.y-d.y)/s],y=[(-c.x-d.x)/r,(-c.y-d.y)/s];let x=K(m,y);return j(m,y)<=-1&&(x=Math.PI),j(m,y)>=1&&(x=0),{currentPoint:l,rX:r,rY:s,sweepFlag:o,xAxisRotation:h,centp:p,a1:f,ad:x}}pathA(t,e){const{pathParser:i}=this,{currentPoint:r,rX:s,rY:n,sweepFlag:a,xAxisRotation:o,centp:h,a1:l,ad:c}=Dt.pathA(i),u=1-a?1:-1,g=l+u*(c/2),d=new lt(h.x+s*Math.cos(g),h.y+n*Math.sin(g));if(i.addMarkerAngle(d,g-u*Math.PI/2),i.addMarkerAngle(r,g-u*Math.PI),e.addPoint(r.x,r.y),t&&!isNaN(l)&&!isNaN(c)){const e=s>n?s:n,i=s>n?1:s/n,r=s>n?n/s:1;t.translate(h.x,h.y),t.rotate(o),t.scale(i,r),t.arc(0,0,e,l,l+c,Boolean(1-a)),t.scale(1/i,1/r),t.rotate(-o),t.translate(-h.x,-h.y)}}static pathZ(t){t.current=t.start}pathZ(t,e){Dt.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}constructor(t,e,i){super(t,e,i),this.type="path",this.pathParser=new Lt(this.getAttribute("d").getString())}}class Bt extends _t{setContext(t){var e;const{document:i}=this,{screen:r,window:s}=i,n=t.canvas;if(r.setDefaults(t),"style"in n&&void 0!==t.font&&s&&void 0!==s.getComputedStyle){t.font=s.getComputedStyle(n).getPropertyValue("font");const e=new at(i,"fontSize",Nt.parse(t.font).fontSize);e.hasValue()&&(i.rootEmSize=e.getPixels("y"),i.emSize=i.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:a,height:o}=r.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");const h=this.getAttribute("refX"),l=this.getAttribute("refY"),c=this.getAttribute("viewBox"),u=c.hasValue()?k(c.getString()):null,g=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden");let d=0,p=0,f=0,m=0;u&&(d=u[0],p=u[1]),this.root||(a=this.getStyle("width").getPixels("x"),o=this.getStyle("height").getPixels("y"),"marker"===this.type&&(f=d,m=p,d=0,p=0)),r.viewPort.setCurrent(a,o),!this.node||this.parent&&"foreignObject"!==(null===(e=this.node.parentNode)||void 0===e?void 0:e.nodeName)||!this.getStyle("transform",!1,!0).hasValue()||this.getStyle("transform-origin",!1,!0).hasValue()||this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(t),t.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),u&&(a=u[2],o=u[3]),i.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:r.viewPort.width,desiredWidth:a,height:r.viewPort.height,desiredHeight:o,minX:d,minY:p,refX:h.getValue(),refY:l.getValue(),clip:g,clipX:f,clipY:m}),u&&(r.viewPort.removeCurrent(),r.viewPort.setCurrent(a,o))}clearContext(t){super.clearContext(t),this.document.screen.viewPort.removeCurrent()}resize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.getAttribute("width",!0),s=this.getAttribute("height",!0),n=this.getAttribute("viewBox"),a=this.getAttribute("style"),o=r.getNumber(0),h=s.getNumber(0);if(i)if("string"==typeof i)this.getAttribute("preserveAspectRatio",!0).setValue(i);else{const t=this.getAttribute("preserveAspectRatio");t.hasValue()&&t.setValue(t.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(r.setValue(t),s.setValue(e),n.hasValue()||n.setValue("0 0 ".concat(o||t," ").concat(h||e)),a.hasValue()){const i=this.getStyle("width"),r=this.getStyle("height");i.hasValue()&&i.setValue("".concat(t,"px")),r.hasValue()&&r.setValue("".concat(e,"px"))}}constructor(...t){super(...t),this.type="svg",this.root=!1}}class zt extends Dt{path(t){const e=this.getAttribute("x").getPixels("x"),i=this.getAttribute("y").getPixels("y"),r=this.getStyle("width",!1,!0).getPixels("x"),s=this.getStyle("height",!1,!0).getPixels("y"),n=this.getAttribute("rx"),a=this.getAttribute("ry");let o=n.getPixels("x"),h=a.getPixels("y");if(n.hasValue()&&!a.hasValue()&&(h=o),a.hasValue()&&!n.hasValue()&&(o=h),o=Math.min(o,r/2),h=Math.min(h,s/2),t){const n=(Math.sqrt(2)-1)/3*4;t.beginPath(),s>0&&r>0&&(t.moveTo(e+o,i),t.lineTo(e+r-o,i),t.bezierCurveTo(e+r-o+n*o,i,e+r,i+h-n*h,e+r,i+h),t.lineTo(e+r,i+s-h),t.bezierCurveTo(e+r,i+s-h+n*h,e+r-o+n*o,i+s,e+r-o,i+s),t.lineTo(e+o,i+s),t.bezierCurveTo(e+o-n*o,i+s,e,i+s-h+n*h,e,i+s-h),t.lineTo(e,i+h),t.bezierCurveTo(e,i+h-n*h,e+o-n*o,i,e+o,i),t.closePath())}return new Vt(e,i,e+r,i+s)}getMarkers(){return null}constructor(...t){super(...t),this.type="rect"}}class Ft extends Dt{path(t){const e=this.getAttribute("cx").getPixels("x"),i=this.getAttribute("cy").getPixels("y"),r=this.getAttribute("r").getPixels();return t&&r>0&&(t.beginPath(),t.arc(e,i,r,0,2*Math.PI,!1),t.closePath()),new Vt(e-r,i-r,e+r,i+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="circle"}}class Ut extends Dt{path(t){const e=(Math.sqrt(2)-1)/3*4,i=this.getAttribute("rx").getPixels("x"),r=this.getAttribute("ry").getPixels("y"),s=this.getAttribute("cx").getPixels("x"),n=this.getAttribute("cy").getPixels("y");return t&&i>0&&r>0&&(t.beginPath(),t.moveTo(s+i,n),t.bezierCurveTo(s+i,n+e*r,s+e*i,n+r,s,n+r),t.bezierCurveTo(s-e*i,n+r,s-i,n+e*r,s-i,n),t.bezierCurveTo(s-i,n-e*r,s-e*i,n-r,s,n-r),t.bezierCurveTo(s+e*i,n-r,s+i,n-e*r,s+i,n),t.closePath()),new Vt(s-i,n-r,s+i,n+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="ellipse"}}class Ht extends Dt{getPoints(){return[new lt(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new lt(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(t){const[{x:e,y:i},{x:r,y:s}]=this.getPoints();return t&&(t.beginPath(),t.moveTo(e,i),t.lineTo(r,s)),new Vt(e,i,r,s)}getMarkers(){const[t,e]=this.getPoints(),i=t.angleTo(e);return[[t,i],[e,i]]}constructor(...t){super(...t),this.type="line"}}class Xt extends Dt{path(t){const{points:e}=this,[{x:i,y:r}]=e,s=new Vt(i,r);return t&&(t.beginPath(),t.moveTo(i,r)),e.forEach((e=>{let{x:i,y:r}=e;s.addPoint(i,r),t&&t.lineTo(i,r)})),s}getMarkers(){const{points:t}=this,e=t.length-1,i=[];return t.forEach(((r,s)=>{s!==e&&i.push([r,r.angleTo(t[s+1])])})),i.length>0&&i.push([t[t.length-1],i[i.length-1][1]]),i}constructor(t,e,i){super(t,e,i),this.type="polyline",this.points=[],this.points=lt.parsePath(this.getAttribute("points").getString())}}class Yt extends Xt{path(t){const e=super.path(t),[{x:i,y:r}]=this.points;return t&&(t.lineTo(i,r),t.closePath()),e}constructor(...t){super(...t),this.type="polygon"}}class qt extends Ct{createPattern(t,e,i){const r=this.getStyle("width").getPixels("x",!0),s=this.getStyle("height").getPixels("y",!0),n=new Bt(this.document,null);n.attributes.viewBox=new at(this.document,"viewBox",this.getAttribute("viewBox").getValue()),n.attributes.width=new at(this.document,"width","".concat(r,"px")),n.attributes.height=new at(this.document,"height","".concat(s,"px")),n.attributes.transform=new at(this.document,"transform",this.getAttribute("patternTransform").getValue()),n.children=this.children;const a=this.document.createCanvas(r,s),o=a.getContext("2d"),h=this.getAttribute("x"),l=this.getAttribute("y");h.hasValue()&&l.hasValue()&&o.translate(h.getPixels("x",!0),l.getPixels("y",!0)),i.hasValue()?this.styles["fill-opacity"]=i:Reflect.deleteProperty(this.styles,"fill-opacity");for(let t=-1;t<=1;t++)for(let e=-1;e<=1;e++)o.save(),n.attributes.x=new at(this.document,"x",t*a.width),n.attributes.y=new at(this.document,"y",e*a.height),n.render(o),o.restore();return t.createPattern(a,"repeat")}constructor(...t){super(...t),this.type="pattern"}}class Wt extends Ct{render(t,e,i){if(!e)return;const{x:r,y:s}=e,n=this.getAttribute("orient").getString("auto"),a=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(r,s),"auto"===n&&t.rotate(i),"strokeWidth"===a&&t.scale(t.lineWidth,t.lineWidth),t.save();const o=new Bt(this.document);o.type=this.type,o.attributes.viewBox=new at(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.refX=new at(this.document,"refX",this.getAttribute("refX").getValue()),o.attributes.refY=new at(this.document,"refY",this.getAttribute("refY").getValue()),o.attributes.width=new at(this.document,"width",this.getAttribute("markerWidth").getValue()),o.attributes.height=new at(this.document,"height",this.getAttribute("markerHeight").getValue()),o.attributes.overflow=new at(this.document,"overflow",this.getAttribute("overflow").getValue()),o.attributes.fill=new at(this.document,"fill",this.getAttribute("fill").getColor("black")),o.attributes.stroke=new at(this.document,"stroke",this.getAttribute("stroke").getValue("none")),o.children=this.children,o.render(t),t.restore(),"strokeWidth"===a&&t.scale(1/t.lineWidth,1/t.lineWidth),"auto"===n&&t.rotate(-i),t.translate(-r,-s)}constructor(...t){super(...t),this.type="marker"}}class Qt extends Ct{render(){}constructor(...t){super(...t),this.type="defs"}}class Gt extends _t{getBoundingBox(t){const e=new Vt;return this.children.forEach((i=>{e.addBoundingBox(i.getBoundingBox(t))})),e}constructor(...t){super(...t),this.type="g"}}class $t extends Ct{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(t,e,i){let r=this;this.getHrefAttribute().hasValue()&&(r=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(r));const{stops:s}=r,n=this.getGradient(t,e);if(!n)return this.addParentOpacity(i,s[s.length-1].color);if(s.forEach((t=>{n.addColorStop(t.offset,this.addParentOpacity(i,t.color))})),this.getAttribute("gradientTransform").hasValue()){const{document:t}=this,{MAX_VIRTUAL_PIXELS:e}=dt,{viewPort:i}=t.screen,r=i.getRoot(),s=new zt(t);s.attributes.x=new at(t,"x",-e/3),s.attributes.y=new at(t,"y",-e/3),s.attributes.width=new at(t,"width",e),s.attributes.height=new at(t,"height",e);const a=new Gt(t);a.attributes.transform=new at(t,"transform",this.getAttribute("gradientTransform").getValue()),a.children=[s];const o=new Bt(t);o.attributes.x=new at(t,"x",0),o.attributes.y=new at(t,"y",0),o.attributes.width=new at(t,"width",r.width),o.attributes.height=new at(t,"height",r.height),o.children=[a];const h=t.createCanvas(r.width,r.height),l=h.getContext("2d");return l.fillStyle=n,o.render(l),l.createPattern(h,"no-repeat")}return n}inheritStopContainer(t){this.attributesToInherit.forEach((e=>{!this.getAttribute(e).hasValue()&&t.getAttribute(e).hasValue()&&this.getAttribute(e,!0).setValue(t.getAttribute(e).getValue())}))}addParentOpacity(t,e){return t.hasValue()?new at(this.document,"color",e).addOpacity(t).getColor():e}constructor(t,e,i){super(t,e,i),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:r,children:s}=this;s.forEach((t=>{"stop"===t.type&&r.push(t)}))}}class Zt extends $t{getGradient(t,e){const i="objectBoundingBox"===this.getGradientUnits(),r=i?e.getBoundingBox(t):null;if(i&&!r)return null;this.getAttribute("x1").hasValue()||this.getAttribute("y1").hasValue()||this.getAttribute("x2").hasValue()||this.getAttribute("y2").hasValue()||(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));const s=i?r.x+r.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),n=i?r.y+r.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),a=i?r.x+r.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),o=i?r.y+r.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return s===a&&n===o?null:t.createLinearGradient(s,n,a,o)}constructor(t,e,i){super(t,e,i),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}}class jt extends $t{getGradient(t,e){const i="objectBoundingBox"===this.getGradientUnits(),r=e.getBoundingBox(t);if(i&&!r)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");const s=i?r.x+r.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),n=i?r.y+r.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let a=s,o=n;this.getAttribute("fx").hasValue()&&(a=i?r.x+r.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(o=i?r.y+r.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const h=i?(r.width+r.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),l=this.getAttribute("fr").getPixels();return t.createRadialGradient(a,o,l,s,n,h)}constructor(t,e,i){super(t,e,i),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}}class Kt extends Ct{constructor(t,e,i){super(t,e,i),this.type="stop";const r=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),s=this.getStyle("stop-opacity");let n=this.getStyle("stop-color",!0);""===n.getString()&&n.setValue("#000"),s.hasValue()&&(n=n.addOpacity(s)),this.offset=r,this.color=n.getColor()}}class Jt extends Ct{getProperty(){const t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return"CSS"===t?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}calcValue(){const{initialUnits:t}=this,{progress:e,from:i,to:r}=this.getProgress();let s=i.getNumber()+(r.getNumber()-i.getNumber())*e;return"%"===t&&(s*=100),"".concat(s).concat(t)}update(t){const{parent:e}=this,i=this.getProperty();if(this.initialValue||(this.initialValue=i.getString(),this.initialUnits=i.getUnits()),this.duration>this.maxDuration){const t=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==t||this.frozen){if("remove"===t&&!this.removed)return this.removed=!0,e&&i&&i.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,e&&i&&(e.animationFrozen=!0,e.animationFrozenValue=i.getString());return!1}this.duration+=t;let r=!1;if(this.begine+(s[i]-e)*t)).join(" ");return n}constructor(...t){super(...t),this.type="animateTransform"}}class ie extends Ct{constructor(t,e,i){super(t,e,i),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class re extends Dt{constructor(t,e,i){super(t,e,i),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class se extends re{constructor(...t){super(...t),this.type="missing-glyph",this.horizAdvX=0}}class ne extends Ct{render(){}constructor(t,e,i){super(t,e,i),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:r}=t,{children:s}=this;for(const t of s)if(t instanceof ie){this.fontFace=t;const e=t.getStyle("font-family");e.hasValue()&&(r[e.getString()]=this)}else if(t instanceof se)this.missingGlyph=t;else if(t instanceof re)if(t.arabicForm){this.isRTL=!0,this.isArabic=!0;const e=this.arabicGlyphs[t.unicode];void 0===e?this.arabicGlyphs[t.unicode]={[t.arabicForm]:t}:e[t.arabicForm]=t}else this.glyphs[t.unicode]=t}}class ae extends Rt{getText(){const t=this.getHrefAttribute().getDefinition();if(t){const e=t.children[0];if(e)return e.getText()}return""}constructor(...t){super(...t),this.type="tref"}}class oe extends Rt{getText(){return this.text}renderChildren(t){if(this.hasText){super.renderChildren(t);const{document:e,x:i,y:r}=this,{mouse:s}=e.screen,n=new at(e,"fontSize",Nt.parse(e.ctx.font).fontSize);s.isWorking()&&s.checkBoundingBox(this,new Vt(i,r-n.getPixels("y"),i+this.measureText(t),r))}else if(this.children.length>0){const e=new Gt(this.document);e.children=this.children,e.parent=this,e.render(t)}}onClick(){const{window:t}=this.document;t&&t.open(this.getHrefAttribute().getString())}onMouseMove(){this.document.ctx.canvas.style.cursor="pointer"}constructor(t,e,i){super(t,e,i),this.type="a";const{childNodes:r}=e,s=r[0],n=r.length>0&&Array.from(r).every((t=>3===t.nodeType));this.hasText=n,this.text=n?this.getTextFromNode(s):""}}class he extends Rt{getText(){return this.text}path(t){const{dataArray:e}=this;t&&t.beginPath(),e.forEach((e=>{let{type:i,points:r}=e;switch(i){case Lt.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case Lt.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case Lt.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case Lt.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case Lt.ARC:{const[e,i,s,n,a,o,h,l]=r,c=s>n?s:n,u=s>n?1:s/n,g=s>n?n/s:1;t&&(t.translate(e,i),t.rotate(h),t.scale(u,g),t.arc(0,0,c,a,a+o,Boolean(1-l)),t.scale(1/u,1/g),t.rotate(-h),t.translate(-e,-i));break}case Lt.CLOSE_PATH:t&&t.closePath()}}))}renderChildren(t){this.setTextData(t),t.save();const e=this.parent.getStyle("text-decoration").getString(),i=this.getFontSize(),{glyphInfo:r}=this,s=t.fillStyle;"underline"===e&&t.beginPath(),r.forEach(((r,s)=>{const{p0:n,p1:a,rotation:o,text:h}=r;t.save(),t.translate(n.x,n.y),t.rotate(o),t.fillStyle&&t.fillText(h,0,0),t.strokeStyle&&t.strokeText(h,0,0),t.restore(),"underline"===e&&(0===s&&t.moveTo(n.x,n.y+i/8),t.lineTo(a.x,a.y+i/5))})),"underline"===e&&(t.lineWidth=i/20,t.strokeStyle=s,t.stroke(),t.closePath()),t.restore()}getLetterSpacingAt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[t]||0}findSegmentToFitChar(t,e,i,r,s,n,a,o,h){let l=n,c=this.measureText(t,o);" "===o&&"justify"===e&&i-1&&(l+=this.getLetterSpacingAt(h));const u=this.textHeight/20,g=this.getEquidistantPointOnPath(l,u,0),d=this.getEquidistantPointOnPath(l+c,u,0),p={p0:g,p1:d},f=g&&d?Math.atan2(d.y-g.y,d.x-g.x):0;if(a){const t=Math.cos(Math.PI/2+f)*a,e=Math.cos(-f)*a;p.p0={...g,x:g.x+t,y:g.y+e},p.p1={...d,x:d.x+t,y:d.y+e}}return l+=c,{offset:l,segment:p,rotation:f}}measureText(t,e){const{measuresCache:i}=this,r=e||this.getText();if(i.has(r))return i.get(r);const s=this.measureTargetText(t,r);return i.set(r,s),s}setTextData(t){if(this.glyphInfo)return;const e=this.getText(),i=e.split(""),r=e.split(" ").length-1,s=this.parent.getAttribute("dx").split().map((t=>t.getPixels("x"))),n=this.parent.getAttribute("dy").getPixels("y"),a=this.parent.getStyle("text-anchor").getString("start"),o=this.getStyle("letter-spacing"),h=this.parent.getStyle("letter-spacing");let l=0;o.hasValue()&&"inherit"!==o.getValue()?o.hasValue()&&"initial"!==o.getValue()&&"unset"!==o.getValue()&&(l=o.getPixels()):l=h.getPixels();const c=[],u=e.length;this.letterSpacingCache=c;for(let t=0;t0===i?0:t+e||0),0),d=this.measureText(t),p=Math.max(d+g,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];const f=this.getPathLength(),m=this.getStyle("startOffset").getNumber(0)*f;let y=0;"middle"!==a&&"center"!==a||(y=-p/2),"end"!==a&&"right"!==a||(y=-p),y+=m,i.forEach(((e,s)=>{const{offset:o,segment:h,rotation:l}=this.findSegmentToFitChar(t,a,p,f,r,y,n,e,s);y=o,h.p0&&h.p1&&this.glyphInfo.push({text:i[s],p0:h.p0,p1:h.p1,rotation:l})}))}parsePathData(t){if(this.pathLength=-1,!t)return[];const e=[],{pathParser:i}=t;for(i.reset();!i.isEnd();){const{current:t}=i,r=t?t.x:0,s=t?t.y:0,n=i.next();let a=n.type,o=[];switch(n.type){case Lt.MOVE_TO:this.pathM(i,o);break;case Lt.LINE_TO:a=this.pathL(i,o);break;case Lt.HORIZ_LINE_TO:a=this.pathH(i,o);break;case Lt.VERT_LINE_TO:a=this.pathV(i,o);break;case Lt.CURVE_TO:this.pathC(i,o);break;case Lt.SMOOTH_CURVE_TO:a=this.pathS(i,o);break;case Lt.QUAD_TO:this.pathQ(i,o);break;case Lt.SMOOTH_QUAD_TO:a=this.pathT(i,o);break;case Lt.ARC:o=this.pathA(i);break;case Lt.CLOSE_PATH:Dt.pathZ(i)}n.type!==Lt.CLOSE_PATH?e.push({type:a,points:o,start:{x:r,y:s},pathLength:this.calcLength(r,s,a,o)}):e.push({type:Lt.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){const{x:i,y:r}=Dt.pathM(t).point;e.push(i,r)}pathL(t,e){const{x:i,y:r}=Dt.pathL(t).point;return e.push(i,r),Lt.LINE_TO}pathH(t,e){const{x:i,y:r}=Dt.pathH(t).point;return e.push(i,r),Lt.LINE_TO}pathV(t,e){const{x:i,y:r}=Dt.pathV(t).point;return e.push(i,r),Lt.LINE_TO}pathC(t,e){const{point:i,controlPoint:r,currentPoint:s}=Dt.pathC(t);e.push(i.x,i.y,r.x,r.y,s.x,s.y)}pathS(t,e){const{point:i,controlPoint:r,currentPoint:s}=Dt.pathS(t);return e.push(i.x,i.y,r.x,r.y,s.x,s.y),Lt.CURVE_TO}pathQ(t,e){const{controlPoint:i,currentPoint:r}=Dt.pathQ(t);e.push(i.x,i.y,r.x,r.y)}pathT(t,e){const{controlPoint:i,currentPoint:r}=Dt.pathT(t);return e.push(i.x,i.y,r.x,r.y),Lt.QUAD_TO}pathA(t){let{rX:e,rY:i,sweepFlag:r,xAxisRotation:s,centp:n,a1:a,ad:o}=Dt.pathA(t);return 0===r&&o>0&&(o-=2*Math.PI),1===r&&o<0&&(o+=2*Math.PI),[n.x,n.y,e,i,a,o,s,r]}calcLength(t,e,i,r){let s=0,n=null,a=null,o=0;switch(i){case Lt.LINE_TO:return this.getLineLength(t,e,r[0],r[1]);case Lt.CURVE_TO:for(s=0,n=this.getPointOnCubicBezier(0,t,e,r[0],r[1],r[2],r[3],r[4],r[5]),o=.01;o<=1;o+=.01)a=this.getPointOnCubicBezier(o,t,e,r[0],r[1],r[2],r[3],r[4],r[5]),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;return s;case Lt.QUAD_TO:for(s=0,n=this.getPointOnQuadraticBezier(0,t,e,r[0],r[1],r[2],r[3]),o=.01;o<=1;o+=.01)a=this.getPointOnQuadraticBezier(o,t,e,r[0],r[1],r[2],r[3]),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;return s;case Lt.ARC:{s=0;const t=r[4],e=r[5],i=r[4]+e;let h=Math.PI/180;if(Math.abs(t-i)i;o-=h)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;else for(o=t+h;o5&&void 0!==arguments[5]?arguments[5]:e,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:i;const o=(s-i)/(r-e+$);let h=Math.sqrt(t*t/(1+o*o));re)return null;const{dataArray:s}=this;for(const e of s){if(e&&(e.pathLength<5e-5||i+e.pathLength+5e-5=0&&n>a)break;r=this.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],n,e.points[6]);break}case Lt.CURVE_TO:n=s/e.pathLength,n>1&&(n=1),r=this.getPointOnCubicBezier(n,e.start.x,e.start.y,e.points[0],e.points[1],e.points[2],e.points[3],e.points[4],e.points[5]);break;case Lt.QUAD_TO:n=s/e.pathLength,n>1&&(n=1),r=this.getPointOnQuadraticBezier(n,e.start.x,e.start.y,e.points[0],e.points[1],e.points[2],e.points[3])}if(r)return r;break}return null}getLineLength(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}getPathLength(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce(((t,e)=>e.pathLength>0?t+e.pathLength:t),0)),this.pathLength}getPointOnCubicBezier(t,e,i,r,s,n,a,o,h){return{x:o*J(t)+n*tt(t)+r*et(t)+e*it(t),y:h*J(t)+a*tt(t)+s*et(t)+i*it(t)}}getPointOnQuadraticBezier(t,e,i,r,s,n,a){return{x:n*rt(t)+r*st(t)+e*nt(t),y:a*rt(t)+s*st(t)+i*nt(t)}}getPointOnEllipticalArc(t,e,i,r,s,n){const a=Math.cos(n),o=Math.sin(n),h=i*Math.cos(s),l=r*Math.sin(s);return{x:t+(h*a-l*o),y:e+(h*o+l*a)}}buildEquidistantCache(t,e){const i=this.getPathLength(),r=e||.25,s=t||i/100;if(!this.equidistantCache||this.equidistantCache.step!==s||this.equidistantCache.precision!==r){this.equidistantCache={step:s,precision:r,points:[]};let t=0;for(let e=0;e<=i;e+=r){const i=this.getPointOnPath(e),n=this.getPointOnPath(e+r);i&&n&&(t+=this.getLineLength(i.x,i.y,n.x,n.y),t>=s&&(this.equidistantCache.points.push({x:i.x,y:i.y,distance:e}),t-=s))}}}getEquidistantPointOnPath(t,e,i){if(this.buildEquidistantCache(e,i),t<0||t-this.getPathLength()>5e-5)return null;const r=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[r]||null}constructor(t,e,i){super(t,e,i),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const r=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(r)}}const le=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class ce extends _t{async loadImage(t){try{const e=await this.document.createImage(t);this.image=e}catch(e){console.error('Error while loading image "'.concat(t,'":'),e)}this.loaded=!0}async loadSvg(t){const e=le.exec(t);if(e){const t=e[5];t&&("base64"===e[4]?this.image=atob(t):this.image=decodeURIComponent(t))}else try{const e=await this.document.fetch(t),i=await e.text();this.image=i}catch(e){console.error('Error while loading image "'.concat(t,'":'),e)}this.loaded=!0}renderChildren(t){const{document:e,image:i,loaded:r}=this,s=this.getAttribute("x").getPixels("x"),n=this.getAttribute("y").getPixels("y"),a=this.getStyle("width").getPixels("x"),o=this.getStyle("height").getPixels("y");if(r&&i&&a&&o){if(t.save(),t.translate(s,n),"string"==typeof i){const r=e.canvg.forkString(t,i,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:a,scaleHeight:o}),{documentElement:s}=r.document;s&&(s.parent=this),r.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:a,desiredWidth:i.width,height:o,desiredHeight:i.height}),this.loaded&&("complete"in i&&!i.complete||t.drawImage(i,0,0));t.restore()}}getBoundingBox(){const t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),i=this.getStyle("width").getPixels("x"),r=this.getStyle("height").getPixels("y");return new Vt(t,e,t+i,e+r)}constructor(t,e,i){super(t,e,i),this.type="image",this.loaded=!1;const r=this.getHrefAttribute().getString();if(!r)return;const s=r.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(r);t.images.push(this),s?this.loadSvg(r):this.loadImage(r)}}class ue extends _t{render(t){}constructor(...t){super(...t),this.type="symbol"}}class ge{async load(t,e){try{const{document:i}=this,r=(await i.canvg.parser.load(e)).getElementsByTagName("font");Array.from(r).forEach((e=>{const r=i.createElement(e);i.definitions[t]=r}))}catch(t){console.error('Error while loading font "'.concat(e,'":'),t)}this.loaded=!0}constructor(t){this.document=t,this.loaded=!1,t.fonts.push(this)}}class de extends Ct{constructor(t,e,i){super(t,e,i),this.type="style";const r=V(Array.from(e.childNodes).map((t=>t.textContent)).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,""));r.split("}").forEach((e=>{const i=e.trim();if(!i)return;const r=i.split("{"),s=r[0].split(","),n=r[1].split(";");s.forEach((e=>{const i=e.trim();if(!i)return;const r=t.styles[i]||{};if(n.forEach((e=>{const i=e.indexOf(":"),s=e.substr(0,i).trim(),n=e.substr(i+1,e.length-i).trim();s&&n&&(r[s]=new at(t,s,n))})),t.styles[i]=r,t.stylesSpecificity[i]=G(i),"@font-face"===i){const e=r["font-family"].getString().replace(/"|'/g,"");r.src.getString().split(",").forEach((i=>{if(i.indexOf('format("svg")')>0){const r=B(i);r&&new ge(t).load(e,r)}}))}}))}))}}de.parseExternalUrl=B;class pe extends _t{setContext(t){super.setContext(t);const e=this.getAttribute("x"),i=this.getAttribute("y");e.hasValue()&&t.translate(e.getPixels("x"),0),i.hasValue()&&t.translate(0,i.getPixels("y"))}path(t){const{element:e}=this;e&&e.path(t)}renderChildren(t){const{document:e,element:i}=this;if(i){let r=i;if("symbol"===i.type&&(r=new Bt(e),r.attributes.viewBox=new at(e,"viewBox",i.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new at(e,"preserveAspectRatio",i.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new at(e,"overflow",i.getAttribute("overflow").getString()),r.children=i.children,i.styles.opacity=new at(e,"opacity",this.calculateOpacity())),"svg"===r.type){const t=this.getStyle("width",!1,!0),i=this.getStyle("height",!1,!0);t.hasValue()&&(r.attributes.width=new at(e,"width",t.getString())),i.hasValue()&&(r.attributes.height=new at(e,"height",i.getString()))}const s=r.parent;r.parent=this,r.render(t),r.parent=s}}getBoundingBox(t){const{element:e}=this;return e?e.getBoundingBox(t):null}elementTransform(){const{document:t,element:e}=this;return e?At.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}}function fe(t,e,i,r,s,n){return t[i*r*4+4*e+n]}function me(t,e,i,r,s,n,a){t[i*r*4+4*e+n]=a}function ye(t,e,i){return t[e]*i}function xe(t,e,i,r){return e+Math.cos(t)*i+Math.sin(t)*r}class be extends Ct{apply(t,e,i,r,s){const{includeOpacity:n,matrix:a}=this,o=t.getImageData(0,0,r,s);for(let t=0;t{e.addBoundingBox(i.getBoundingBox(t))})),r=Math.floor(e.x1),s=Math.floor(e.y1),n=Math.floor(e.width),a=Math.floor(e.height)}const o=this.removeStyles(e,ve.ignoreStyles),h=i.createCanvas(r+n,s+a),l=h.getContext("2d");i.screen.setDefaults(l),this.renderChildren(l),new be(i,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(l,0,0,r+n,s+a);const c=i.createCanvas(r+n,s+a),u=c.getContext("2d");i.screen.setDefaults(u),e.render(u),u.globalCompositeOperation="destination-in",u.fillStyle=l.createPattern(h,"no-repeat"),u.fillRect(0,0,r+n,s+a),t.fillStyle=u.createPattern(c,"no-repeat"),t.fillRect(0,0,r+n,s+a),this.restoreStyles(e,o)}render(t){}constructor(...t){super(...t),this.type="mask"}}ve.ignoreStyles=["mask","transform","clip-path"];const Se=()=>{};class Te extends Ct{apply(t){const{document:e}=this,i=Reflect.getPrototypeOf(t),{beginPath:r,closePath:s}=t;i&&(i.beginPath=Se,i.closePath=Se),Reflect.apply(r,t,[]),this.children.forEach((r=>{if(!("path"in r))return;let n="elementTransform"in r?r.elementTransform():null;n||(n=At.fromElement(e,r)),n&&n.apply(t),r.path(t),i&&(i.closePath=s),n&&n.unapply(t)})),Reflect.apply(s,t,[]),t.clip(),i&&(i.beginPath=r,i.closePath=s)}render(t){}constructor(...t){super(...t),this.type="clipPath"}}class we extends Ct{apply(t,e){const{document:i,children:r}=this,s="getBoundingBox"in e?e.getBoundingBox(t):null;if(!s)return;let n=0,a=0;r.forEach((t=>{const e=t.extraFilterDistance||0;n=Math.max(n,e),a=Math.max(a,e)}));const o=Math.floor(s.width),h=Math.floor(s.height),l=o+2*n,c=h+2*a;if(l<1||c<1)return;const u=Math.floor(s.x),g=Math.floor(s.y),d=this.removeStyles(e,we.ignoreStyles),p=i.createCanvas(l,c),f=p.getContext("2d");i.screen.setDefaults(f),f.translate(-u+n,-g+a),e.render(f),r.forEach((t=>{"function"==typeof t.apply&&t.apply(f,0,0,l,c)})),t.drawImage(p,0,0,l,c,u-n,g-a,l,c),this.restoreStyles(e,d)}render(t){}constructor(...t){super(...t),this.type="filter"}}we.ignoreStyles=["filter","transform","clip-path"];class Ae extends Ct{apply(t,e,i,r,s){}constructor(t,e,i){super(t,e,i),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class Ce extends Ct{apply(t,e,i,r,s){}constructor(...t){super(...t),this.type="feMorphology"}}class Ee extends Ct{apply(t,e,i,r,s){}constructor(...t){super(...t),this.type="feComposite"}}class Pe extends Ct{apply(t,e,i,r,s){const{document:n,blurRadius:a}=this,o=n.window?n.window.document.body:null,h=t.canvas;h.id=n.getUniqueId(),o&&(h.style.display="none",o.appendChild(h)),O(h,e,i,r,s,a),o&&o.removeChild(h)}constructor(t,e,i){super(t,e,i),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}}class Oe extends Ct{constructor(...t){super(...t),this.type="title"}}class Me extends Ct{constructor(...t){super(...t),this.type="desc"}}const Ne={svg:Bt,rect:zt,circle:Ft,ellipse:Ut,line:Ht,polyline:Xt,polygon:Yt,path:Dt,pattern:qt,marker:Wt,defs:Qt,linearGradient:Zt,radialGradient:jt,stop:Kt,animate:Jt,animateColor:te,animateTransform:ee,font:ne,"font-face":ie,"missing-glyph":se,glyph:re,text:Rt,tspan:kt,tref:ae,a:oe,textPath:he,image:ce,g:Gt,symbol:ue,style:de,use:pe,mask:ve,clipPath:Te,filter:we,feDropShadow:Ae,feMorphology:Ce,feComposite:Ee,feColorMatrix:be,feGaussianBlur:Pe,title:Oe,desc:Me};class Ve{bindCreateImage(t,e){return"boolean"==typeof e?(i,r)=>t(i,"boolean"==typeof r?r:e):t}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){const{emSizeStack:t}=this;return t[t.length-1]||12}set emSize(t){const{emSizeStack:e}=this;e.push(t)}popEmSize(){const{emSizeStack:t}=this;t.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every((t=>t.loaded))}isFontsLoaded(){return this.fonts.every((t=>t.loaded))}createDocumentElement(t){const e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}createElement(t){const e=t.nodeName.replace(/^[^:]+:/,""),i=Ve.elementTypes[e];return i?new i(this,t):new Et(this,t)}createTextNode(t){return new It(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=12,emSize:i=12,createCanvas:r=Ve.createCanvas,createImage:s=Ve.createImage,anonymousCrossOrigin:n}={}){this.canvg=t,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=t.screen,this.rootEmSize=e,this.emSize=i,this.createCanvas=r,this.createImage=this.bindCreateImage(s,n),this.screen.wait((()=>this.isImagesLoaded())),this.screen.wait((()=>this.isFontsLoaded()))}}Ve.createCanvas=function(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},Ve.createImage=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");return e&&(i.crossOrigin="Anonymous"),new Promise(((e,r)=>{i.onload=()=>{e(i)},i.onerror=(t,e,i,s,n)=>{r(n)},i.src=t}))},Ve.elementTypes=Ne;class _e{static async from(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new mt(i),s=await r.parse(e);return new _e(t,s,i)}static fromString(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new mt(i).parseFromString(e);return new _e(t,r,i)}fork(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return _e.from(t,e,{...this.options,...i})}forkString(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return _e.fromString(t,e,{...this.options,...i})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...t}),await this.ready(),this.stop()}start(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{documentElement:e,screen:i,options:r}=this;i.start(e,{enableRedraw:!0,...r,...t})}stop(){this.screen.stop()}resize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(t,e,i)}constructor(t,e,i={}){this.parser=new mt(i),this.screen=new dt(t,i),this.options=i;const r=new Ve(this,i),s=r.createDocumentElement(e);this.document=r,this.documentElement=s}}},2855:t=>{t.exports=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={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",feldspar:"d19275",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",lightslateblue:"8470ff",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",rebeccapurple:"663399",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",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var i=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r3&&(this.alpha=o[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=new Array,r=0;r "+l.toRGB()+" -> "+l.toHex());h.appendChild(c),h.appendChild(u),o.appendChild(h)}catch(t){}return o}}},3146:(t,e,i)=>{for(var r=i(3491),s="undefined"==typeof window?i.g:window,n=["moz","webkit"],a="AnimationFrame",o=s["request"+a],h=s["cancel"+a]||s["cancelRequest"+a],l=0;!o&&l{var n={2:(t,n,e)=>{var r=e(6926),a=e(9310);(t.exports=function(t,n){return a[t]||(a[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.28.0",mode:r?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.28.0/LICENSE",source:"https://github.com/zloirock/core-js"})},54:(t,n,e)=>{"use strict";var r,a,o=e(2368),i=e(281),l=e(5362),s=e(6844),d=e(2192),c=e(2),p=e(3105),u=e(9206).get,m=e(1036),f=e(8121),g=c("native-string-replace",String.prototype.replace),b=RegExp.prototype.exec,h=b,v=i("".charAt),x=i("".indexOf),y=i("".replace),w=i("".slice),T=(a=/b*/g,o(b,r=/a/,"a"),o(b,a,"a"),0!==r.lastIndex||0!==a.lastIndex),_=d.BROKEN_CARET,k=void 0!==/()??/.exec("")[1];(T||k||_||m||f)&&(h=function(t){var n,e,r,a,i,d,c,m=this,f=u(m),S=l(t),C=f.raw;if(C)return C.lastIndex=m.lastIndex,n=o(h,C,S),m.lastIndex=C.lastIndex,n;var D=f.groups,L=_&&m.sticky,A=o(s,m),E=m.source,j=0,F=S;if(L&&(A=y(A,"y",""),-1===x(A,"g")&&(A+="g"),F=w(S,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==v(S,m.lastIndex-1))&&(E="(?: "+E+")",F=" "+F,j++),e=new RegExp("^(?:"+E+")",A)),k&&(e=new RegExp("^"+E+"$(?!\\s)",A)),T&&(r=m.lastIndex),a=o(b,L?e:m,F),L?a?(a.input=w(a.input,j),a[0]=w(a[0],j),a.index=m.lastIndex,m.lastIndex+=a[0].length):m.lastIndex=0:T&&a&&(m.lastIndex=m.global?a.index+a[0].length:r),k&&a&&a.length>1&&o(g,a[0],e,(function(){for(i=1;i{"use strict";var r=e(9070),a=e(2368),o=e(281),i=e(779),l=e(2074),s=e(3938),d=e(8420),c=e(8406),p=e(9328),u=e(3747),m=e(5362),f=e(1229),g=e(7234),b=e(6457),h=e(4433),v=e(6793),x=e(1602)("replace"),y=Math.max,w=Math.min,T=o([].concat),_=o([].push),k=o("".indexOf),S=o("".slice),C="$0"==="a".replace(/./,"$0"),D=!!/./[x]&&""===/./[x]("a","$0");i("replace",(function(t,n,e){var o=D?"$":"$0";return[function(t,e){var r=f(this),o=c(t)?void 0:b(t,x);return o?a(o,t,r,e):a(n,m(r),t,e)},function(t,a){var i=s(this),l=m(t);if("string"==typeof a&&-1===k(a,o)&&-1===k(a,"$<")){var c=e(n,i,l,a);if(c.done)return c.value}var f=d(a);f||(a=m(a));var b=i.global;if(b){var x=i.unicode;i.lastIndex=0}for(var C=[];;){var D=v(i,l);if(null===D)break;if(_(C,D),!b)break;""===m(D[0])&&(i.lastIndex=g(l,u(i.lastIndex),x))}for(var L,A="",E=0,j=0;j=E&&(A+=S(l,E,N)+M,E=N+F.length)}return A+S(l,E)}]}),!!l((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}))||!C||D)},200:(t,n,e)=>{var r=function(t){return t&&t.Math==Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof e.g&&e.g)||function(){return this}()||Function("return this")()},281:(t,n,e)=>{var r=e(8823),a=Function.prototype,o=a.call,i=r&&a.bind.bind(o,o);t.exports=r?i:function(t){return function(){return o.apply(t,arguments)}}},290:t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},353:(t,n,e)=>{var r=e(2368),a=e(6490),o=e(7658),i=e(6844),l=RegExp.prototype;t.exports=function(t){var n=t.flags;return void 0!==n||"flags"in l||a(t,"flags")||!o(l,t)?n:r(i,t)}},540:t=>{"use strict";t.exports=function(t){var n=document.createElement("style");return t.setAttributes(n,t.attributes),t.insert(n,t.options),n}},580:t=>{"use strict";var n=/["'&<>]/;t.exports=function(t){var e,r=""+t,a=n.exec(r);if(!a)return r;var o="",i=0,l=0;for(i=a.index;i{var r=e(281),a=0,o=Math.random(),i=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+i(++a+o,36)}},779:(t,n,e)=>{"use strict";e(7136);var r=e(3091),a=e(7485),o=e(54),i=e(2074),l=e(1602),s=e(7712),d=l("species"),c=RegExp.prototype;t.exports=function(t,n,e,p){var u=l(t),m=!i((function(){var n={};return n[u]=function(){return 7},7!=""[t](n)})),f=m&&!i((function(){var n=!1,e=/a/;return"split"===t&&((e={}).constructor={},e.constructor[d]=function(){return e},e.flags="",e[u]=/./[u]),e.exec=function(){return n=!0,null},e[u](""),!n}));if(!m||!f||e){var g=r(/./[u]),b=n(u,""[t],(function(t,n,e,a,i){var l=r(t),s=n.exec;return s===o||s===c.exec?m&&!i?{done:!0,value:g(n,e,a)}:{done:!0,value:l(e,n,a)}:{done:!1}}));a(String.prototype,t,b[0]),a(c,u,b[1])}p&&s(c[u],"sham",!0)}},874:(t,n,e)=>{var r=e(2368),a=e(5335),o=e(2328),i=e(6457),l=e(9751),s=e(1602),d=TypeError,c=s("toPrimitive");t.exports=function(t,n){if(!a(t)||o(t))return t;var e,s=i(t,c);if(s){if(void 0===n&&(n="default"),e=r(s,t,n),!a(e)||o(e))return e;throw d("Can't convert object to primitive value")}return void 0===n&&(n="number"),l(t,n)}},1036:(t,n,e)=>{var r=e(2074),a=e(200).RegExp;t.exports=r((function(){var t=a(".","s");return!(t.dotAll&&t.exec("\n")&&"s"===t.flags)}))},1113:t=>{"use strict";t.exports=function(t,n){if(n.styleSheet)n.styleSheet.cssText=t;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(t))}}},1144:t=>{"use strict";t.exports="data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 fill=%27%23fff%27%3e%3cpath d=%27M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z%27/%3e%3c/svg%3e"},1229:(t,n,e)=>{var r=e(8406),a=TypeError;t.exports=function(t){if(r(t))throw a("Can't call method on "+t);return t}},1479:t=>{"use strict";t.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNiI+CiAgPHBhdGggZD0iTTE0IDEyLjNMMTIuMyAxNCA4IDkuNyAzLjcgMTQgMiAxMi4zIDYuMyA4IDIgMy43IDMuNyAyIDggNi4zIDEyLjMgMiAxNCAzLjcgOS43IDh6IiBzdHlsZT0iZmlsbC1vcGFjaXR5OjE7ZmlsbDojZmZmZmZmIi8+Cjwvc3ZnPgo="},1601:t=>{"use strict";t.exports=function(t){return t[1]}},1602:(t,n,e)=>{var r=e(200),a=e(2),o=e(6490),i=e(665),l=e(2072),s=e(5225),d=r.Symbol,c=a("wks"),p=s?d.for||d:d&&d.withoutSetter||i;t.exports=function(t){return o(c,t)||(c[t]=l&&o(d,t)?d[t]:p("Symbol."+t)),c[t]}},1605:(t,n,e)=>{var r=e(200),a=e(7632).f,o=e(7712),i=e(7485),l=e(9430),s=e(4361),d=e(4977);t.exports=function(t,n){var e,c,p,u,m,f=t.target,g=t.global,b=t.stat;if(e=g?r:b?r[f]||l(f,{}):(r[f]||{}).prototype)for(c in n){if(u=n[c],p=t.dontCallGetSet?(m=a(e,c))&&m.value:e[c],!d(g?c:f+(b?".":"#")+c,t.forced)&&void 0!==p){if(typeof u==typeof p)continue;s(u,p)}(t.sham||p&&p.sham)&&o(u,"sham",!0),i(e,c,u,t)}}},1641:(t,n,e)=>{var r=e(6347),a=e(290);t.exports=Object.keys||function(t){return r(t,a)}},1688:(t,n,e)=>{"use strict";var r=e(5077),a=e(281),o=e(2368),i=e(2074),l=e(1641),s=e(8916),d=e(9304),c=e(2612),p=e(8664),u=Object.assign,m=Object.defineProperty,f=a([].concat);t.exports=!u||i((function(){if(r&&1!==u({b:1},u(m({},"a",{enumerable:!0,get:function(){m(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},n={},e=Symbol(),a="abcdefghijklmnopqrst";return t[e]=7,a.split("").forEach((function(t){n[t]=t})),7!=u({},t)[e]||l(u({},n)).join("")!=a}))?function(t,n){for(var e=c(t),a=arguments.length,i=1,u=s.f,m=d.f;a>i;)for(var g,b=p(arguments[i++]),h=u?f(l(b),u(b)):l(b),v=h.length,x=0;v>x;)g=h[x++],r&&!o(m,b,g)||(e[g]=b[g]);return e}:u},2071:(t,n,e)=>{var r=e(5077),a=e(6490),o=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,l=a(o,"name"),s=l&&"something"===function(){}.name,d=l&&(!r||r&&i(o,"name").configurable);t.exports={EXISTS:l,PROPER:s,CONFIGURABLE:d}},2072:(t,n,e)=>{var r=e(6845),a=e(2074);t.exports=!!Object.getOwnPropertySymbols&&!a((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},2074:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},2192:(t,n,e)=>{var r=e(2074),a=e(200).RegExp,o=r((function(){var t=a("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),i=o||r((function(){return!a("a","y").sticky})),l=o||r((function(){var t=a("^r","gy");return t.lastIndex=2,null!=t.exec("str")}));t.exports={BROKEN_CARET:l,MISSED_STICKY:i,UNSUPPORTED_Y:o}},2328:(t,n,e)=>{var r=e(6492),a=e(8420),o=e(7658),i=e(5225),l=Object;t.exports=i?function(t){return"symbol"==typeof t}:function(t){var n=r("Symbol");return a(n)&&o(n.prototype,l(t))}},2349:(t,n,e)=>{"use strict";var r=e(2074);t.exports=function(t,n){var e=[][t];return!!e&&r((function(){e.call(null,n||function(){return 1},1)}))}},2368:(t,n,e)=>{var r=e(8823),a=Function.prototype.call;t.exports=r?a.bind(a):function(){return a.apply(a,arguments)}},2612:(t,n,e)=>{var r=e(1229),a=Object;t.exports=function(t){return a(r(t))}},2838:function(t){t.exports=function(){"use strict";function t(n){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(n)}function n(t,e){return n=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},n(t,e)}function e(t,r,a){return e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var a=[null];a.push.apply(a,e);var o=new(Function.bind.apply(t,a));return r&&n(o,r.prototype),o},e.apply(null,arguments)}function r(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,n){if(t){if("string"==typeof t)return a(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,n):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e1?e-1:0),a=1;a/gm),G=p(/\${[\w\W]*}/gm),W=p(/^data-[\-\w.\u00B7-\uFFFF]/),J=p(/^aria-[\-\w]+$/),X=p(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=p(/^(?:\w+script|data):/i),Y=p(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),K=p(/^html$/i),Z=function(){return"undefined"==typeof window?null:window};return function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Z(),a=function(t){return n(t)};if(a.version="2.4.4",a.removed=[],!e||!e.document||9!==e.document.nodeType)return a.isSupported=!1,a;var o=e.document,i=e.document,l=e.DocumentFragment,s=e.HTMLTemplateElement,d=e.Node,p=e.Element,u=e.NodeFilter,m=e.NamedNodeMap,f=void 0===m?e.NamedNodeMap||e.MozNamedAttrMap:m,g=e.HTMLFormElement,b=e.DOMParser,L=e.trustedTypes,Q=p.prototype,tt=j(Q,"cloneNode"),nt=j(Q,"nextSibling"),et=j(Q,"childNodes"),rt=j(Q,"parentNode");if("function"==typeof s){var at=i.createElement("template");at.content&&at.content.ownerDocument&&(i=at.content.ownerDocument)}var ot=function(n,e){if("object"!==t(n)||"function"!=typeof n.createPolicy)return null;var r=null,a="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(a)&&(r=e.currentScript.getAttribute(a));var o="dompurify"+(r?"#"+r:"");try{return n.createPolicy(o,{createHTML:function(t){return t},createScriptURL:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(L,o),it=ot?ot.createHTML(""):"",lt=i,st=lt.implementation,dt=lt.createNodeIterator,ct=lt.createDocumentFragment,pt=lt.getElementsByTagName,ut=o.importNode,mt={};try{mt=E(i).documentMode?i.documentMode:{}}catch(t){}var ft={};a.isSupported="function"==typeof rt&&st&&void 0!==st.createHTMLDocument&&9!==mt;var gt,bt,ht=q,vt=B,xt=G,yt=W,wt=J,Tt=V,_t=Y,kt=X,St=null,Ct=A({},[].concat(r(F),r(N),r(O),r(I),r(M))),Dt=null,Lt=A({},[].concat(r(z),r(H),r(U),r($))),At=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Et=null,jt=null,Ft=!0,Nt=!0,Ot=!1,Pt=!0,It=!1,Rt=!1,Mt=!1,zt=!1,Ht=!1,Ut=!1,$t=!1,qt=!0,Bt=!1,Gt=!0,Wt=!1,Jt={},Xt=null,Vt=A({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Yt=null,Kt=A({},["audio","video","img","source","image","track"]),Zt=null,Qt=A({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tn="http://www.w3.org/1998/Math/MathML",nn="http://www.w3.org/2000/svg",en="http://www.w3.org/1999/xhtml",rn=en,an=!1,on=null,ln=A({},[tn,nn,en],w),sn=["application/xhtml+xml","text/html"],dn=null,cn=i.createElement("form"),pn=function(t){return t instanceof RegExp||t instanceof Function},un=function(n){dn&&dn===n||(n&&"object"===t(n)||(n={}),n=E(n),gt=gt=-1===sn.indexOf(n.PARSER_MEDIA_TYPE)?"text/html":n.PARSER_MEDIA_TYPE,bt="application/xhtml+xml"===gt?w:y,St="ALLOWED_TAGS"in n?A({},n.ALLOWED_TAGS,bt):Ct,Dt="ALLOWED_ATTR"in n?A({},n.ALLOWED_ATTR,bt):Lt,on="ALLOWED_NAMESPACES"in n?A({},n.ALLOWED_NAMESPACES,w):ln,Zt="ADD_URI_SAFE_ATTR"in n?A(E(Qt),n.ADD_URI_SAFE_ATTR,bt):Qt,Yt="ADD_DATA_URI_TAGS"in n?A(E(Kt),n.ADD_DATA_URI_TAGS,bt):Kt,Xt="FORBID_CONTENTS"in n?A({},n.FORBID_CONTENTS,bt):Vt,Et="FORBID_TAGS"in n?A({},n.FORBID_TAGS,bt):{},jt="FORBID_ATTR"in n?A({},n.FORBID_ATTR,bt):{},Jt="USE_PROFILES"in n&&n.USE_PROFILES,Ft=!1!==n.ALLOW_ARIA_ATTR,Nt=!1!==n.ALLOW_DATA_ATTR,Ot=n.ALLOW_UNKNOWN_PROTOCOLS||!1,Pt=!1!==n.ALLOW_SELF_CLOSE_IN_ATTR,It=n.SAFE_FOR_TEMPLATES||!1,Rt=n.WHOLE_DOCUMENT||!1,Ht=n.RETURN_DOM||!1,Ut=n.RETURN_DOM_FRAGMENT||!1,$t=n.RETURN_TRUSTED_TYPE||!1,zt=n.FORCE_BODY||!1,qt=!1!==n.SANITIZE_DOM,Bt=n.SANITIZE_NAMED_PROPS||!1,Gt=!1!==n.KEEP_CONTENT,Wt=n.IN_PLACE||!1,kt=n.ALLOWED_URI_REGEXP||kt,rn=n.NAMESPACE||en,n.CUSTOM_ELEMENT_HANDLING&&pn(n.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(At.tagNameCheck=n.CUSTOM_ELEMENT_HANDLING.tagNameCheck),n.CUSTOM_ELEMENT_HANDLING&&pn(n.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(At.attributeNameCheck=n.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),n.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof n.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(At.allowCustomizedBuiltInElements=n.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),It&&(Nt=!1),Ut&&(Ht=!0),Jt&&(St=A({},r(M)),Dt=[],!0===Jt.html&&(A(St,F),A(Dt,z)),!0===Jt.svg&&(A(St,N),A(Dt,H),A(Dt,$)),!0===Jt.svgFilters&&(A(St,O),A(Dt,H),A(Dt,$)),!0===Jt.mathMl&&(A(St,I),A(Dt,U),A(Dt,$))),n.ADD_TAGS&&(St===Ct&&(St=E(St)),A(St,n.ADD_TAGS,bt)),n.ADD_ATTR&&(Dt===Lt&&(Dt=E(Dt)),A(Dt,n.ADD_ATTR,bt)),n.ADD_URI_SAFE_ATTR&&A(Zt,n.ADD_URI_SAFE_ATTR,bt),n.FORBID_CONTENTS&&(Xt===Vt&&(Xt=E(Xt)),A(Xt,n.FORBID_CONTENTS,bt)),Gt&&(St["#text"]=!0),Rt&&A(St,["html","head","body"]),St.table&&(A(St,["tbody"]),delete Et.tbody),c&&c(n),dn=n)},mn=A({},["mi","mo","mn","ms","mtext"]),fn=A({},["foreignobject","desc","title","annotation-xml"]),gn=A({},["title","style","font","a","script"]),bn=A({},N);A(bn,O),A(bn,P);var hn=A({},I);A(hn,R);var vn=function(t){x(a.removed,{element:t});try{t.parentNode.removeChild(t)}catch(n){try{t.outerHTML=it}catch(n){t.remove()}}},xn=function(t,n){try{x(a.removed,{attribute:n.getAttributeNode(t),from:n})}catch(t){x(a.removed,{attribute:null,from:n})}if(n.removeAttribute(t),"is"===t&&!Dt[t])if(Ht||Ut)try{vn(n)}catch(t){}else try{n.setAttribute(t,"")}catch(t){}},yn=function(t){var n,e;if(zt)t=""+t;else{var r=T(t,/^[\r\n\t ]+/);e=r&&r[0]}"application/xhtml+xml"===gt&&rn===en&&(t=''+t+"");var a=ot?ot.createHTML(t):t;if(rn===en)try{n=(new b).parseFromString(a,gt)}catch(t){}if(!n||!n.documentElement){n=st.createDocument(rn,"template",null);try{n.documentElement.innerHTML=an?it:a}catch(t){}}var o=n.body||n.documentElement;return t&&e&&o.insertBefore(i.createTextNode(e),o.childNodes[0]||null),rn===en?pt.call(n,Rt?"html":"body")[0]:Rt?n.documentElement:o},wn=function(t){return dt.call(t.ownerDocument||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,null,!1)},Tn=function(n){return"object"===t(d)?n instanceof d:n&&"object"===t(n)&&"number"==typeof n.nodeType&&"string"==typeof n.nodeName},_n=function(t,n,e){ft[t]&&h(ft[t],(function(t){t.call(a,n,e,dn)}))},kn=function(t){var n,e;if(_n("beforeSanitizeElements",t,null),(e=t)instanceof g&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof f)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes))return vn(t),!0;if(C(/[\u0080-\uFFFF]/,t.nodeName))return vn(t),!0;var r=bt(t.nodeName);if(_n("uponSanitizeElement",t,{tagName:r,allowedTags:St}),t.hasChildNodes()&&!Tn(t.firstElementChild)&&(!Tn(t.content)||!Tn(t.content.firstElementChild))&&C(/<[/\w]/g,t.innerHTML)&&C(/<[/\w]/g,t.textContent))return vn(t),!0;if("select"===r&&C(/