@simplesmoothsafe/pptb-dependency-cleaner 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -6
- package/dist/assets/index-BPWxIlef.js +16 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/index-9RUEqmwc.js +0 -16
package/README.md
CHANGED
|
@@ -6,21 +6,33 @@ Built by [Simple Smooth Safe](https://simplesmoothsafe.com).
|
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
9
|
-
- **Diagnose** — for each component of the solution, asks Dataverse for its required components (`RetrieveRequiredComponents`, 4 in parallel, with progress, cancel and a per-session cache), finds the managed solution that owns each one, and groups the result by the component you can act on. A component that is itself owned by a managed solution (a Field Service column pulled in by "add all assets") counts too.
|
|
9
|
+
- **Diagnose** — for each component of the solution, asks Dataverse for its required components (`RetrieveRequiredComponents`, 4 in parallel, with progress, cancel and a per-session cache), finds the managed solution that owns each one (see *How ownership is decided*), and groups the result by the component you can act on. A component that is itself owned by a managed solution (a Field Service column pulled in by "add all assets") counts too.
|
|
10
10
|
- **Filter** — publisher prefixes or solution names, default `msdyn, msdynce, mspp`. Editable, so it works for any ISV.
|
|
11
11
|
- **Target awareness** — with a secondary connection (the target environment), solutions already there are marked "present in target" and hidden by default; any managed solution missing in the target is a blocker. Without one, everything matching the filter is a blocker.
|
|
12
12
|
- **Fix** — per finding, pick a fix:
|
|
13
|
-
- *Convert table to shell*: a table added with all assets is removed and added back with `DoNotIncludeSubcomponents`. Every subcomponent that would leave is listed
|
|
13
|
+
- *Convert table to shell*: a table added with all assets is removed and added back with `DoNotIncludeSubcomponents`. Every subcomponent that would leave is listed and can be ticked back in or out. Ticked by default: columns with your publisher prefix, the forms/views you edit, and every form, view and chart not owned by a managed solution matching the filter (these are named by display name, so ownership decides, not the prefix). A table cannot be converted to a shell by one finding and removed by another: the preview refuses the conflict until you pick one.
|
|
14
14
|
- *Remove from solution* for a column, form or view included directly.
|
|
15
|
-
- *Edit form*: remove the cells/controls bound to the msdyn columns (never the primary name or a required column, which are reported instead
|
|
15
|
+
- *Edit form*: remove the cells/controls bound to the msdyn columns, hidden fields (`<hiddencontrols>`) bound to them, and subgrids / quick views on msdyn tables (quick views are read from the entity-escaped `<QuickForms>` text real formxml uses); never the primary name or a required column, which are reported instead; drop empty sections.
|
|
16
16
|
- *Edit view*: strip the msdyn attributes, conditions, orders and link-entities from fetchxml and the matching cells from layoutxml.
|
|
17
17
|
- Relationships, sitemap, apps, ribbon, charts, processes, web resources and plugin steps are report only, with a link to the solution in the maker portal.
|
|
18
18
|
- **Preview → backup → confirm** — the preview lists every operation with a before/after XML diff. Confirm stays disabled until the backup (`dependency-cleaner-backup-<solution>-<timestamp>.json`: original form/view XML and the full solution membership) is saved. Then: membership changes → form/view updates → one `PublishXml` for the touched tables → the diagnosis runs again and shows fixed / still present.
|
|
19
|
-
- **Restore** — load a backup, preview, apply: original XML written back, removed components re-added, tables put back to all assets, then published.
|
|
19
|
+
- **Restore** — load a backup, preview, apply: original XML written back, removed components re-added, tables put back to all assets, then published. A backup only restores into the environment it was taken in (its url is recorded in the file).
|
|
20
20
|
- **Offline** — open an exported solution zip and read `solution.xml` `<MissingDependencies>` (the list the import checks), grouped and filtered the same way. No connection needed.
|
|
21
|
+
- **Name lookups that fail** (metadata, form or view names) are shown as a warning above the findings, and every finding that involves such a component is report only: an edit keyed on an unresolved name would change nothing. Reads by id run 4 at a time; a throttled read (HTTP 429) is retried once after its `Retry-After`.
|
|
21
22
|
- **Export** — findings as JSON or CSV (cells a spreadsheet would read as a formula are prefixed with `'`).
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
## How ownership is decided
|
|
25
|
+
|
|
26
|
+
A component belongs to the solution that **created** it, not to every managed solution that has a solution component row for it. In a D365 dev environment every msdyn app that extends account or contact (Sales, Field Service…) has a row for the table and often for its main form; those tables and forms are still System's. First match wins:
|
|
27
|
+
|
|
28
|
+
1. Dataverse names the base (creating) solution in a dependency row (`requiredcomponentbasesolutionid`), and it is managed: that solution.
|
|
29
|
+
2. Platform component: table `IsCustomEntity = false`, column `IsCustomAttribute = false`, or, for forms, views and other types, the System solution contains it. Owner System, never in the filter, always present in the target.
|
|
30
|
+
3. Exactly one other managed solution contains it: that one.
|
|
31
|
+
4. Several: the one whose publisher prefix is the component's schema-name prefix (`msdyn_x` → `msdyn`); else the first when all match the filter; else the first outside the filter. Ambiguous ownership is never read as msdyn-owned, so nothing is removed or dropped on a guess.
|
|
32
|
+
|
|
33
|
+
A dependency is present in the target when any managed solution that contains the component is installed there.
|
|
34
|
+
|
|
35
|
+
Safety: managed solutions are never offered and writes are refused if the solution turns out to be managed when re-checked right before writing; a Production-looking connection needs an explicit tick. Changing the connection clears the diagnosis, the preview and the backup tick; Confirm and Restore re-read the current connection and refuse when it is not the one the plan was made on. After a new diagnosis, a picked fix the finding no longer offers is dropped. Confirm runs once, however often it is clicked, and the re-diagnosis after a fix always covers the solution that was fixed, whatever the picker shows.
|
|
24
36
|
|
|
25
37
|
## Install
|
|
26
38
|
|
|
@@ -49,7 +61,7 @@ Then in ToolBox: Debug → *Load Local Tool* → select the `tools/dependency-cl
|
|
|
49
61
|
- `RetrieveRequiredComponents` is one call per component: a large solution means hundreds of calls. They run 4 at a time, can be cancelled, and are cached for the session. Its response shape through the host is also **UNVERIFIED**; the tool accepts `EntityCollection` as an array or as `{ Entities }`.
|
|
50
62
|
- Forms with msdyn PCF controls, libraries or event handlers get warnings, not edits. A view whose only filter or sort used msdyn columns gets a warning.
|
|
51
63
|
- Converting a table to a shell in a solution other developers use removes subcomponents they may rely on: read the list in the preview.
|
|
52
|
-
-
|
|
64
|
+
- Ownership (above) relies on the base solution Dataverse reports, table / column metadata and System membership. A custom form or view contained by several managed solutions of different publishers is treated as not msdyn-owned.
|
|
53
65
|
|
|
54
66
|
## Privacy
|
|
55
67
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var Or=Object.defineProperty;var $r=(Y,ze,W)=>ze in Y?Or(Y,ze,{enumerable:!0,configurable:!0,writable:!0,value:W}):Y[ze]=W;var wt=(Y,ze,W)=>$r(Y,typeof ze!="symbol"?ze+"":ze,W);(function(){"use strict";const Y=t=>{const a=document.querySelector(t);if(!a)throw new Error(`missing ${t}`);return a};function ze(t,...a){for(const e of a)e!=null&&e!==!1&&t.append(e)}function W(t,a={},...e){const d=document.createElement(t);for(const[i,r]of Object.entries(a))r===void 0||r===!1||(i==="class"?d.className=String(r):r===!0?d.setAttribute(i,""):d.setAttribute(i,r));for(const i of e)i!=null&&i!==!1&&d.append(typeof i=="string"?document.createTextNode(i):i);return d}const me=(t,a="")=>W("span",{class:`badge${a?` badge-${a}`:""}`},t),Be=(t,a)=>W("div",{class:"empty-state"},W("strong",{},t),a);function kn(t){const a=Y("#dlg");Y("#dlg-title").textContent=t.title;const e=Y("#dlg-target");e.replaceChildren(),t.target&&e.append(t.target),Y("#dlg-body").replaceChildren(t.body);const d=Y("#dlg-ok");return d.textContent=t.okLabel??"",d.className=`btn ${t.danger?"btn-danger":"btn-primary"}`,d.style.flex="none",d.hidden=!t.okLabel,new Promise(i=>{let r=!1;const s=o=>{r||(r=!0,d.onclick=null,Y("#dlg-cancel").onclick=null,a.onclose=null,a.open?(a.addEventListener("close",()=>i(o),{once:!0}),a.close()):i(o))};d.onclick=()=>s(!0),Y("#dlg-cancel").onclick=()=>s(!1),a.onclose=()=>s(!1),a.showModal()})}function xn(t){document.querySelectorAll(".tab").forEach(a=>a.addEventListener("click",()=>{const e=a.dataset.tab;document.querySelectorAll(".tab").forEach(d=>d.classList.toggle("is-active",d===a)),document.querySelectorAll(".panel[id^='tab-']").forEach(d=>d.hidden=d.id!==`tab-${e}`)}))}const ne={Entity:1,Attribute:2,Relationship:3,OptionSet:9,EntityRelationship:10,View:26,Workflow:29,Chart:59,Form:60,WebResource:61,SiteMap:62,AppModule:80,PluginStep:92},Sn={1:"Table",2:"Column",3:"Relationship",9:"Choice",10:"Relationship",14:"Key",20:"Security role",24:"Form",26:"View",29:"Process",31:"Report",36:"Email template",48:"Ribbon command",50:"Ribbon",55:"Ribbon diff",59:"Chart",60:"Form",61:"Web resource",62:"Site map",63:"Connection role",65:"Hierarchy rule",66:"Custom control",70:"Field security profile",80:"Model-driven app",90:"Plugin type",91:"Plugin assembly",92:"Plugin step",300:"Canvas app",371:"Connector",372:"Connection reference",380:"Environment variable"},_e=t=>Sn[t]??`Type ${t}`,Cn=["msdyn","msdynce","mspp"],ot=t=>t==null||t===""?null:String(t),ye=t=>String(t??"").toLowerCase(),Ot=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function st(t,a="id"){if(!Ot.test(t))throw new Error(`${a} is not a guid: ${t}`);return t.toLowerCase()}function En(t){const a=t.match(/\/api\/data\/v\d+(?:\.\d+)*\/(.*)$/i);return a?a[1]:t}const $t=500;async function bt(t,a,e="primary"){const d=[],i=new Set;let r=a;for(let s=0;r&&s<$t;s++){const o=await t.queryData(r,e);d.push(...o.value??[]);const u=o["@odata.nextLink"];if(r=typeof u=="string"&&u?En(u):null,r&&i.has(r))throw new Error(`paging loop at ${r}`);r&&i.add(r)}if(r)throw new Error(`more than ${$t} pages for ${a.split("?")[0]}`);return d}const Tt=40,An=4,In=1500,Nn=3e4;function zn(t){let a=0;const e=[];return async d=>{a>=t?await new Promise(i=>e.push(i)):a++;try{return await d()}finally{const i=e.shift();i?i():a--}}}const Rn=zn(An);function On(t){var s,o,u,v,_;const a=t??{},e=String(a.message??t??"");if(Number(a.status??a.statusCode??((s=a.response)==null?void 0:s.status)??NaN)!==429&&!/\b429\b|too many requests/i.test(e))return null;const i=a.retryAfter??((o=a.headers)==null?void 0:o["retry-after"])??((v=(u=a.response)==null?void 0:u.headers)==null?void 0:v["retry-after"])??((_=/retry-after\W+(\d+(?:\.\d+)?)/i.exec(e))==null?void 0:_[1]),r=Number(i);return Number.isFinite(r)&&r>=0?Math.min(r*1e3,Nn):In}async function $n(t){try{return await t()}catch(a){const e=On(a);if(e===null)throw a;return await new Promise(d=>setTimeout(d,e)),t()}}async function at(t,a,e,d,i="primary"){const r=[...new Set(a.map(u=>u.toLowerCase()))].filter(u=>Ot.test(u)),s=[];for(let u=0;u<r.length;u+=Tt)s.push(r.slice(u,u+Tt));return(await Promise.all(s.map(u=>Rn(()=>$n(()=>bt(t,d(u.map(v=>`${e} eq ${v}`).join(" or ")),i)))))).flat()}async function Tn(t,a,e,d=()=>!1){let i=0;const r=async()=>{for(;i<t.length&&!d();){const s=t[i++];await e(s)}};await Promise.all(Array.from({length:Math.min(a,t.length)},r))}async function vt(t,a="primary"){const[e,d]=await Promise.all([t.getSolutions(["solutionid","uniquename","friendlyname","version","ismanaged","_publisherid_value"],a),bt(t,"publishers?$select=publisherid,uniquename,customizationprefix",a).catch(()=>[])]),i=new Map(d.map(r=>[ye(r.publisherid),String(r.customizationprefix??"").toLowerCase()]));return e.value.map(r=>{const s=r._publisherid_value?ye(r._publisherid_value):null;return{id:ye(r.solutionid),uniqueName:String(r.uniquename??""),friendlyName:ot(r.friendlyname)??String(r.uniquename??""),version:String(r.version??""),isManaged:!!r.ismanaged,publisherId:s,prefix:s?i.get(s)??"":""}}).sort((r,s)=>r.friendlyName.localeCompare(s.friendlyName))}async function Bt(t,a){const d=(await t.queryData(`solutions?$select=solutionid,uniquename,ismanaged&$filter=solutionid eq ${st(a,"solution id")}`)).value[0];return d?{isManaged:!!d.ismanaged,uniqueName:String(d.uniquename??"")}:null}async function jt(t,a){return(await bt(t,`solutioncomponents?$select=solutioncomponentid,objectid,componenttype,rootcomponentbehavior,_rootsolutioncomponentid_value&$filter=_solutionid_value eq ${st(a,"solution id")}`)).map(d=>({rowId:ye(d.solutioncomponentid),objectId:ye(d.objectid),type:Number(d.componenttype??0),behavior:d.rootcomponentbehavior==null?null:Number(d.rootcomponentbehavior),rootRowId:d._rootsolutioncomponentid_value?ye(d._rootsolutioncomponentid_value):null}))}function Bn(t){const a=t;if(!a)return[];const e=a.EntityCollection;if(Array.isArray(e))return e;if(e&&typeof e=="object"){const d=e.Entities??e.value;if(Array.isArray(d))return d}return Array.isArray(a.value)?a.value:[]}const We=(t,a)=>t[a]??t[`_${a}_value`];async function jn(t,a,e){const d=st(a,"component id");if(!Number.isInteger(e))throw new Error(`bad component type ${e}`);const i=await t.queryData(`RetrieveRequiredComponents(ObjectId=${d},ComponentType=${e})`);return Bn(i).map(r=>({requiredId:ye(We(r,"requiredcomponentobjectid")),requiredType:Number(We(r,"requiredcomponenttype")??0),requiredParentId:We(r,"requiredcomponentparentid")?ye(We(r,"requiredcomponentparentid")):null,requiredBaseSolutionId:We(r,"requiredcomponentbasesolutionid")?ye(We(r,"requiredcomponentbasesolutionid")):null}))}async function Dn(t,a){const e=await at(t,a,"objectid",i=>`solutioncomponents?$select=objectid,componenttype,_solutionid_value&$filter=${i}`),d=new Map;for(const i of e){const r=ye(i.objectid),s=d.get(r)??[],o=ye(i._solutionid_value);o&&!s.includes(o)&&s.push(o),d.set(r,s)}return d}const Dt=t=>typeof t=="boolean"?t:null;class Lt{constructor(){wt(this,"entities",null);wt(this,"attributes",new Map);wt(this,"names",new Map)}async entitiesById(a){if(this.entities)return this.entities;const e=await a.getAllEntitiesMetadata(["LogicalName","MetadataId","PrimaryNameAttribute","IsCustomEntity"]);return this.entities=new Map(e.value.map(d=>[ye(d.MetadataId),{id:ye(d.MetadataId),logicalName:String(d.LogicalName??""),primaryName:ot(d.PrimaryNameAttribute),isCustom:Dt(d.IsCustomEntity)}])),this.entities}async entityByName(a,e){const d=await this.entitiesById(a);for(const i of d.values())if(i.logicalName===e)return i}async attributesOf(a,e){const d=this.attributes.get(e);if(d)return d;const r=(await a.getEntityRelatedMetadata(e,"Attributes",["LogicalName","MetadataId","RequiredLevel","IsCustomAttribute"])).value.map(s=>{var o;return{id:ye(s.MetadataId),logicalName:String(s.LogicalName??""),requiredLevel:String(((o=s.RequiredLevel)==null?void 0:o.Value)??s.RequiredLevel??"None"),isCustom:Dt(s.IsCustomAttribute)}});return this.attributes.set(e,r),r}async protectedColumns(a,e){const d=await this.entityByName(a,e),i=await this.attributesOf(a,e).catch(()=>[]),r=new Set;d!=null&&d.primaryName&&r.add(d.primaryName);for(const s of i)(s.requiredLevel==="ApplicationRequired"||s.requiredLevel==="SystemRequired")&&r.add(s.logicalName);return[...r]}}const Ft={[ne.View]:["savedqueries","savedqueryid","name","returnedtypecode"],[ne.Form]:["systemforms","formid","name","objecttypecode"],[ne.Chart]:["savedqueryvisualizations","savedqueryvisualizationid","name","primaryentitytypecode"],[ne.WebResource]:["webresourceset","webresourceid","name"],[ne.Workflow]:["workflows","workflowid","name","primaryentity"],[ne.SiteMap]:["sitemaps","sitemapid","sitemapname"],[ne.AppModule]:["appmodules","appmoduleid","name"],[ne.PluginStep]:["sdkmessageprocessingsteps","sdkmessageprocessingstepid","name"],20:["roles","roleid","name"],300:["canvasapps","canvasappid","name"],372:["connectionreferences","connectionreferenceid","connectionreferencelogicalname"],380:["environmentvariabledefinitions","environmentvariabledefinitionid","schemaname"]};async function Ln(t,a,e,d){var f;const i=(m,l)=>`${m}:${l}`,r=new Map,s=e.filter(m=>{const l=a.names.get(i(m.type,m.id));return l&&r.set(i(m.type,m.id),l),!l});if(!s.length)return r;const o=m=>{r.set(i(m.type,m.id),m),a.names.set(i(m.type,m.id),m)},u=m=>(m==null?void 0:m.message)??String(m),v=(m,l)=>{for(const h of m)d==null||d.set(i(h.type,h.id),u(l))},_=await a.entitiesById(t).catch(m=>(v(s.filter(l=>l.type===ne.Entity||l.type===ne.Attribute),m),new Map));for(const m of s.filter(l=>l.type===ne.Entity)){const l=_.get(m.id);l&&o({type:m.type,id:m.id,name:l.logicalName,table:l.logicalName})}const w=new Map;for(const m of s.filter(l=>l.type===ne.Attribute)){const l=m.parentId??"";w.set(l,[...w.get(l)??[],m])}for(const[m,l]of w){const h=(f=_.get(m))==null?void 0:f.logicalName;if(!h)continue;const p=await a.attributesOf(t,h).catch(g=>(v(l,g),[]));for(const g of l){const k=p.find(y=>y.id===g.id);k&&o({type:g.type,id:g.id,name:k.logicalName,table:h})}}const C=new Map;for(const m of s)Ft[m.type]&&C.set(m.type,[...C.get(m.type)??[],m.id]);await Promise.all([...C].map(async([m,l])=>{const[h,p,g,k]=Ft[m],y=await at(t,l,p,x=>`${h}?$select=${[p,g,k].filter(Boolean).join(",")}&$filter=${x}`).catch(x=>(v(l.map(z=>({type:m,id:z})),x),[]));for(const x of y)o({type:m,id:ye(x[p]),name:ot(x[g])??ye(x[p]),table:k?ot(x[k])??void 0:void 0})}));for(const m of s.filter(l=>l.type===ne.EntityRelationship||l.type===ne.Relationship))try{const l=await t.queryData(`RelationshipDefinitions(${st(m.id)})?$select=SchemaName`);l!=null&&l.SchemaName&&o({type:m.type,id:m.id,name:String(l.SchemaName)})}catch(l){v([m],l)}for(const m of s)r.has(i(m.type,m.id))||r.set(i(m.type,m.id),{type:m.type,id:m.id,name:m.id});return r}async function Pt(t,a){return(await at(t,a,"formid",d=>`systemforms?$select=formid,name,objecttypecode,formxml&$filter=${d}`)).map(d=>({id:ye(d.formid),name:String(d.name??""),table:String(d.objecttypecode??""),formxml:String(d.formxml??"")}))}async function qt(t,a){return(await at(t,a,"savedqueryid",d=>`savedqueries?$select=savedqueryid,name,returnedtypecode,fetchxml,layoutxml&$filter=${d}`)).map(d=>({id:ye(d.savedqueryid),name:String(d.name??""),table:String(d.returnedtypecode??""),fetchxml:String(d.fetchxml??""),layoutxml:String(d.layoutxml??"")}))}async function Fn(t){var a;try{const e=await t.execute({operationName:"RetrieveCurrentOrganization",operationType:"function",parameters:{AccessType:"Microsoft.Dynamics.CRM.EndpointAccessType'Default'"}}),d=(a=e==null?void 0:e.Detail)==null?void 0:a.EnvironmentId;return typeof d=="string"&&d?d:null}catch{return null}}const le=t=>(t??"").trim().toLowerCase();function _t(t,a){const e=new DOMParser().parseFromString(t,"application/xml");if(e.getElementsByTagName("parsererror").length)throw new Error(`${a}: invalid XML`);return e}function kt(t,a){const e=/^?\s*<\?xml[^?]*\?>\s*/.exec(a),d=new XMLSerializer().serializeToString(t).replace(/^<\?xml[^?]*\?>\s*/,"");return(e?e[0]:"")+d}const he=(t,a)=>Array.from(t.getElementsByTagName(a)),Fe=(t,a)=>Array.from(t.children).filter(e=>!a||e.localName===a);function xe(t){var e,d;const a=t.previousSibling;a&&a.nodeType===3&&!(a.nodeValue??"").trim()&&((e=a.parentNode)==null||e.removeChild(a)),(d=t.parentNode)==null||d.removeChild(t)}function Ze(t){if(t.children.length===0&&!(t.textContent??"").trim())for(;t.firstChild;)t.removeChild(t.firstChild)}const lt=(t,a)=>{for(let e=t.parentElement;e;e=e.parentElement)if(e.localName===a)return e;return null},xt=t=>{var e;return t&&(((e=t.getElementsByTagName("label")[0])==null?void 0:e.getAttribute("description"))||t.getAttribute("name")||t.getAttribute("id"))||""},Pn=t=>new Set(t.map(a=>{var e;return(e=/^([a-z0-9]+_)/.exec(a))==null?void 0:e[1]}).filter(a=>!!a));function qn(t){const a=he(t,"QuickFormId").map(e=>le(e.getAttribute("entityname")));for(const e of he(t,"QuickForms")){if(e.children.length)continue;const d=(e.textContent??"").trim();if(!d.startsWith("<"))continue;const i=new DOMParser().parseFromString(d,"application/xml");if(i.getElementsByTagName("parsererror").length){for(const r of d.matchAll(/entityname\s*=\s*["']([^"']+)["']/gi))a.push(le(r[1]));continue}a.push(...he(i,"QuickFormId").map(r=>le(r.getAttribute("entityname"))))}return a.filter(Boolean)}function Un(t,a,e,d=[]){var k;const i=new Set(a.map(le)),r=new Set(e.map(le)),s=new Set(d.map(le)),o=[],u=[],v=[],_=y=>!o.includes(y)&&o.push(y),w=(y,x)=>!u.some(z=>z.name===y)&&u.push({name:y,reason:x}),C=_t(t,"formxml"),f=new Set,m=new Set,l=new Set,h=new Set;for(const y of he(C,"control")){if(!y.parentNode||!C.documentElement.contains(y))continue;const x=le(y.getAttribute("datafieldname"));let z=null;if(x&&i.has(x)){if(r.has(x)){w(x,"protected: primary name or ApplicationRequired column");continue}z=x}else if(s.size){const A=y.getElementsByTagName("parameters")[0];if(A){const B=le((k=A.getElementsByTagName("TargetEntityType")[0])==null?void 0:k.textContent),K=qn(A).find(E=>s.has(E));B&&s.has(B)?z=`subgrid ${y.getAttribute("id")??"?"} (${B})`:K&&(z=`quickview ${y.getAttribute("id")??"?"} (${K})`)}}if(!z)continue;const I=lt(y,"cell"),F=I&<(I,"row");for(const A of[y.getAttribute("id"),y.getAttribute("uniqueid")])A&&f.add(le(A));x&&z===x&&m.add(x),_(z),I?(xe(I),F&&l.add(F)):xe(y)}for(const y of he(C,"hiddencontrols").flatMap(x=>Fe(x,"data"))){const x=le(y.getAttribute("datafieldname"));if(!x||!i.has(x))continue;if(r.has(x)){w(x,"protected: primary name or ApplicationRequired column");continue}for(const I of[y.getAttribute("id"),y.getAttribute("uniqueid")])I&&f.add(le(I));m.add(x),_(x);const z=y.parentElement;xe(y),z&&Ze(z)}for(const y of l){const x=lt(y,"section");if(x&&h.add(x),Fe(y,"cell").length===0){const z=y.parentElement;xe(y),z&&Ze(z)}}const p=new Set;for(const y of h){const x=lt(y,"tab");if(x&&p.add(x),!he(y,"row").some(I=>Fe(I,"cell").some(F=>F.getElementsByTagName("control").length>0))){v.push(`Section "${xt(y)}"${x?` in tab "${xt(x)}"`:""} became empty and was removed.`);const I=y.parentElement;xe(y),I&&Ze(I)}}for(const y of p)he(y,"control").length===0&&v.push(`Tab "${xt(y)}" is now empty (kept; remove or hide it by hand).`);for(const y of he(C,"controlDescription")){const x=le(y.getAttribute("forControl"));if(x&&f.has(x)){const I=y.parentElement;xe(y),I&&Ze(I);continue}const z=he(y,"*").filter(I=>I.children.length===0).map(I=>le(I.textContent)).find(I=>m.has(I));z&&v.push(`Custom control (controlDescription for ${y.getAttribute("forControl")}) references removed column ${z}; review it by hand.`)}for(const y of he(C,"event")){const x=le(y.getAttribute("attribute"));if(x&&m.has(x)){const z=he(y,"Handler").map(I=>`${I.getAttribute("libraryName")}:${I.getAttribute("functionName")}`);v.push(`Event "${y.getAttribute("name")}" on removed column ${x} still has handlers${z.length?` (${z.join(", ")})`:""}; review the form events.`)}}const g=Pn([...m,...s]);if(o.length&&g.size){const y=new Set,x=[...he(C,"Library").map(z=>z.getAttribute("name")??""),...he(C,"Handler").map(z=>z.getAttribute("libraryName")??"")];for(const z of x){const I=le(z);!I||y.has(I)||(y.add(I),[...g].some(F=>I.startsWith(F)||I.includes("/"+F))&&v.push(`Form library "${z}" belongs to the same publisher as removed components; it may still depend on them.`))}}return{xml:o.length?kt(C,t):t,removed:o,kept:u,warnings:v}}function Mn(t,a,e,d){const i=new Set(e.map(le)),r=new Set(d.map(le)),s=[],o=[],u=new Set,v=new Set;let _=!1,w=t;if(t.trim()){const f=_t(t,"fetchxml"),m=he(f,"entity")[0],l=m?Fe(m,"order").length:0;for(const y of he(f,"link-entity")){if(!f.documentElement.contains(y))continue;const x=le(y.getAttribute("name")),z=le(y.getAttribute("alias"));if(r.has(x)){z&&u.add(z);for(const I of he(y,"link-entity"))I.getAttribute("alias")&&u.add(le(I.getAttribute("alias")));s.push(`link-entity ${x}${z?` (${z})`:""}`),xe(y),_=!0}else z&&v.add(z)}for(const y of he(f,"link-entity"))for(const x of["from","to"]){const z=le(y.getAttribute(x));z&&i.has(z)&&o.push(`link-entity ${y.getAttribute("name")} joins ${x}="${z}", a removed column; the view will break until this join is fixed.`)}for(const y of he(f,"attribute")){const x=le(y.getAttribute("name"));i.has(x)&&(s.push(`attribute ${x}`),xe(y),_=!0)}let h=0;for(const y of he(f,"order")){const x=le(y.getAttribute("attribute")),z=le(y.getAttribute("entityname"));(i.has(x)||z&&u.has(z))&&(s.push(`order ${z?z+".":""}${x}`),xe(y),h++,_=!0)}const p=new Set;let g=0;for(const y of he(f,"condition")){const x=le(y.getAttribute("attribute")),z=le(y.getAttribute("entityname"));if(i.has(x)||z&&u.has(z)){s.push(`condition ${z?z+".":""}${x} ${y.getAttribute("operator")??""}`.trim());const I=y.parentElement;xe(y),(I==null?void 0:I.localName)==="filter"&&p.add(I),g++,_=!0}}const k=[...p];for(;k.length;){const y=k.shift();if(!y.parentNode||Fe(y).some(z=>z.localName==="condition"||z.localName==="filter"))continue;const x=y.parentElement;xe(y),x&&(Ze(x),x.localName==="filter"&&k.push(x))}g&&o.push(`${g} filter condition(s) removed: the view now returns a different (usually larger) set of rows. Review the filter.`),h&&l>0&&m&&Fe(m,"order").length===0&&o.push("The view's only sort order was removed; it will fall back to the default order."),m&&_&&Fe(m,"attribute").length===0&&!m.getElementsByTagName("all-attributes").length&&o.push("The root entity has no attributes left in the view."),_&&(w=kt(f,t))}let C=a;if(a.trim()){const f=_t(a,"layoutxml");let m=!1;for(const l of he(f,"cell")){const h=le(l.getAttribute("name"));if(!h)continue;const p=h.indexOf("."),g=p>=0?h.slice(0,p):"",k=p>=0?h.slice(p+1):h;if(g?u.has(g)||v.has(g)&&i.has(k):i.has(k)){s.push(`cell ${h}`);const x=l.parentElement;xe(l),x&&Ze(x),m=!0}}for(const l of he(f,"grid")){const h=le(l.getAttribute("jump"));h&&i.has(h)&&o.push(`Layout jump column "${h}" was removed; set another primary column for the grid.`)}m&&(C=kt(f,a))}return{fetchxml:w,layoutxml:C,removed:s,warnings:o}}const Wn=t=>({type:t.type,id:t.objectId,name:t.name??t.objectId,table:t.table}),ct=(t,a)=>[...new Set(t.required.filter(e=>e.type===a).map(e=>e.name))];async function Zn(t,a,e,d){var p;const i=[],r=d.filter(g=>g.fix==="edit-form"),s=d.filter(g=>g.fix==="edit-view"),[o,u]=await Promise.all([r.length?Pt(t,r.map(g=>g.finding.dependent.id)):Promise.resolve([]),s.length?qt(t,s.map(g=>g.finding.dependent.id)):Promise.resolve([])]),v=[];for(const g of r){const k=o.find(x=>x.id===g.finding.dependent.id);if(!k){i.push({name:g.finding.dependent.name,reason:"form not found"});continue}const y=await a.protectedColumns(t,k.table);try{const x=Un(k.formxml,ct(g.finding,ne.Attribute),y,ct(g.finding,ne.Entity));x.removed.length?v.push({form:k,after:x.xml,removed:x.removed,kept:x.kept,warnings:x.warnings}):i.push({name:k.name,reason:`nothing to strip${x.kept.length?`: kept ${x.kept.map(z=>`${z.name} (${z.reason})`).join(", ")}`:""}`})}catch(x){i.push({name:k.name,reason:x.message})}}const _=[];for(const g of s){const k=u.find(y=>y.id===g.finding.dependent.id);if(!k){i.push({name:g.finding.dependent.name,reason:"view not found"});continue}try{const y=Mn(k.fetchxml,k.layoutxml,ct(g.finding,ne.Attribute),ct(g.finding,ne.Entity));y.removed.length?_.push({view:k,after:{fetchxml:y.fetchxml,layoutxml:y.layoutxml},removed:y.removed,warnings:y.warnings}):i.push({name:k.name,reason:"nothing to strip"})}catch(y){i.push({name:k.name,reason:y.message})}}const w=new Set([...v.map(g=>g.form.id),..._.map(g=>g.view.id)]),C=e.solution.prefix?`${e.solution.prefix}_`:null,f=[];for(const g of d.filter(k=>k.fix==="shell")){const k=(p=g.finding.fixes.find(I=>I.kind==="shell"))==null?void 0:p.root;if(!k||f.some(I=>I.root.id===k.id))continue;const y=e.components.find(I=>I.type===ne.Entity&&I.objectId===k.id),x=new Set(e.findings.filter(I=>I.dependent.selfOwned).map(I=>I.dependent.id)),z=e.components.filter(I=>y&&I.rootRowId===y.rowId&&I.rowId!==y.rowId).map(I=>{const F=(I.name??"").toLowerCase();if(x.has(I.objectId))return{component:I,keep:!1,why:"belongs to a managed solution in scope"};if(w.has(I.objectId))return{component:I,keep:!0,why:"edited in this plan"};if(C&&F.startsWith(C))return{component:I,keep:!0,why:`your prefix ${C}`};if(I.type===ne.Form||I.type===ne.View||I.type===ne.Chart){if(I.filteredOwner)return{component:I,keep:!1,why:`owned by ${I.filteredOwner}`};if(I.filteredOwner===null)return{component:I,keep:!0,why:"yours: not owned by a filtered managed solution"}}return{component:I,keep:!1,why:"not yours"}}).sort((I,F)=>Number(F.keep)-Number(I.keep)||I.component.type-F.component.type||(I.component.name??"").localeCompare(F.component.name??""));f.push({root:{...k,behavior:0},leaving:z})}const m=d.filter(g=>g.fix==="remove"&&g.finding.dependent.type===ne.Entity).map(g=>f.find(k=>k.root.id===g.finding.dependent.id)).filter(g=>!!g);if(m.length)throw new Error(`Conflicting fixes on table ${m.map(g=>g.root.name).join(", ")}: one finding converts it to a shell, another removes it from the solution. Pick one of the two and preview again.`);const l=new Set(f.map(g=>{var k;return(k=e.components.find(y=>y.type===ne.Entity&&y.objectId===g.root.id))==null?void 0:k.rowId})),h=[];for(const g of d.filter(k=>k.fix==="remove")){const k=e.components.find(y=>y.objectId===g.finding.dependent.id&&y.type===g.finding.dependent.type);if(k!=null&&k.rootRowId&&l.has(k.rootRowId)){i.push({name:g.finding.dependent.name,reason:"leaves with the shell conversion of its table"});continue}h.some(y=>y.id===g.finding.dependent.id)||h.push(g.finding.dependent)}for(const g of d.filter(k=>k.fix==="report"))i.push({name:g.finding.dependent.name,reason:"report only"});return{diagnosis:e,shells:f,removes:h,forms:v,views:_,skipped:i}}function Ut(t){const a=[];for(const i of t.shells){a.push({kind:"remove",component:i.root,reason:`convert ${i.root.name} to a shell`}),a.push({kind:"add",component:i.root,doNotIncludeSubcomponents:!0,reason:"re-add as shell (no subcomponents)"});for(const r of i.leaving.filter(s=>s.keep))a.push({kind:"add",component:Wn(r.component),doNotIncludeSubcomponents:!1,reason:`keep: ${r.why}`})}for(const i of t.removes)a.push({kind:"remove",component:i,reason:`remove ${_e(i.type).toLowerCase()}`});for(const i of t.forms)a.push({kind:"update-form",edit:i});for(const i of t.views)a.push({kind:"update-view",edit:i});const e=[...new Set([...t.forms.map(i=>i.form.table),...t.views.map(i=>i.view.table)].filter(Boolean))].sort();e.length&&a.push({kind:"publish",tables:e});const d=new Set;return a.filter(i=>{if(i.kind!=="remove"&&i.kind!=="add")return!0;const r=`${i.kind}:${i.component.type}:${i.component.id}:${i.kind==="add"?i.doNotIncludeSubcomponents:""}`;return d.has(r)?!1:(d.add(r),!0)})}function Hn(t){const a=e=>e.replace(/[<>&"']/g,d=>`&#${d.charCodeAt(0)};`);return`<importexportxml><entities>${t.map(e=>`<entity>${a(e)}</entity>`).join("")}</entities></importexportxml>`}const Gn=(t,a)=>({operationName:"RemoveSolutionComponent",operationType:"action",parameters:{ComponentId:t.id,ComponentType:t.type,SolutionUniqueName:a}}),Kn=(t,a,e)=>({operationName:"AddSolutionComponent",operationType:"action",parameters:{ComponentId:t.id,ComponentType:t.type,SolutionUniqueName:a,DoNotIncludeSubcomponents:e,AddRequiredComponents:!1}});async function Mt(t,a,e,d){const i=[];let r=!1,s=!1;for(let o=0;o<a.length;o++){const u=a[o];if(d==null||d(o,a.length),r&&!(u.kind==="publish"&&s)){i.push({op:u,ok:!1,skipped:!0,error:"not run: an earlier step failed"});continue}try{u.kind==="remove"?await t.execute(Gn(u.component,e)):u.kind==="add"?await t.execute(Kn(u.component,e,u.doNotIncludeSubcomponents)):u.kind==="update-form"?(await t.update("systemform",u.edit.form.id,{formxml:u.edit.after}),s=!0):u.kind==="update-view"?(await t.update("savedquery",u.edit.view.id,{fetchxml:u.edit.after.fetchxml,layoutxml:u.edit.after.layoutxml}),s=!0):u.kind==="publish"&&await t.execute({operationName:"PublishXml",operationType:"action",parameters:{ParameterXml:Hn(u.tables)}}),i.push({op:u,ok:!0})}catch(v){r=!0,i.push({op:u,ok:!1,error:v.message??String(v)})}}return d==null||d(a.length,a.length),i}function St(t){switch(t.kind){case"remove":return`RemoveSolutionComponent ${_e(t.component.type)} ${t.component.name}`;case"add":return`AddSolutionComponent ${_e(t.component.type)} ${t.component.name}${t.doNotIncludeSubcomponents?" (DoNotIncludeSubcomponents)":""}`;case"update-form":return`Update form ${t.edit.form.name} (${t.edit.form.table}): formxml`;case"update-view":return`Update view ${t.edit.view.name} (${t.edit.view.table}): fetchxml + layoutxml`;case"publish":return`PublishXml ${t.tables.join(", ")}`}}const Wt=t=>t.replace(/>\s*</g,`>
|
|
2
|
+
<`).split(`
|
|
3
|
+
`);function Vn(t,a,e=2){const d=Wt(t),i=Wt(a);let r=0;for(;r<d.length&&r<i.length&&d[r]===i[r];)r++;let s=0;for(;s<d.length-r&&s<i.length-r&&d[d.length-1-s]===i[i.length-1-s];)s++;const o=d.slice(r,d.length-s),u=i.slice(r,i.length-s),v=[];if(o.length*u.length>4e6)v.push(...o.map(f=>({t:"-",s:f})),...u.map(f=>({t:"+",s:f})));else{const f=o.length,m=u.length,l=Array.from({length:f+1},()=>new Uint32Array(m+1));for(let g=f-1;g>=0;g--)for(let k=m-1;k>=0;k--)l[g][k]=o[g]===u[k]?l[g+1][k+1]+1:Math.max(l[g+1][k],l[g][k+1]);let h=0,p=0;for(;h<f||p<m;)h<f&&p<m&&o[h]===u[p]?(v.push({t:" ",s:o[h++]}),p++):p<m&&(h>=f||l[h][p+1]>=l[h+1][p])?v.push({t:"+",s:u[p++]}):v.push({t:"-",s:o[h++]})}const _=[...d.slice(0,r).map(f=>({t:" ",s:f})),...v,...d.slice(d.length-s).map(f=>({t:" ",s:f}))],w=_.map(()=>!1);_.forEach((f,m)=>{if(f.t!==" ")for(let l=-e;l<=e;l++)_[m+l]&&(w[m+l]=!0)});const C=[];return _.forEach((f,m)=>{w[m]?C.push(f):(C.length===0||C[C.length-1].t!=="…")&&C.push({t:"…",s:""})}),C}const Zt="sss-dependency-cleaner-backup";function Yn(t,a,e){const d=new Map(t.components.map(i=>[i.rowId,i]));return{kind:Zt,version:1,takenAt:new Date().toISOString(),environment:{name:t.environment.name,url:t.environment.url},solution:{id:t.solution.id,uniqueName:t.solution.uniqueName,friendlyName:t.solution.friendlyName},membership:t.components.map(i=>{var r;return{objectId:i.objectId,type:i.type,behavior:i.behavior,rootObjectId:i.rootRowId?((r=d.get(i.rootRowId))==null?void 0:r.objectId)??null:null,name:i.name??i.objectId}}),forms:a.forms.map(i=>i.form),views:a.views.map(i=>i.view),operations:e.map(St)}}function Xn(t,a=new Date){const e=a.toISOString().replace(/[:.]/g,"-").slice(0,19);return`dependency-cleaner-backup-${t.replace(/[^a-z0-9._-]+/gi,"_")}-${e}.json`}function Jn(t){var e;let a;try{a=JSON.parse(t)}catch(d){throw new Error(`not JSON: ${d.message}`)}if((a==null?void 0:a.kind)!==Zt)throw new Error("not a Dependency Cleaner backup");if(a.version!==1)throw new Error(`unsupported backup version ${String(a.version)}`);if(!((e=a.solution)!=null&&e.uniqueName)||!Array.isArray(a.membership)||!Array.isArray(a.forms)||!Array.isArray(a.views))throw new Error("backup is incomplete");return a}async function Qn(t,a,e,d){var l;const i=e.find(h=>h.uniqueName.toLowerCase()===a.solution.uniqueName.toLowerCase());if(!i)throw new Error(`solution ${a.solution.uniqueName} is not in this environment`);if(i.isManaged)throw new Error(`solution ${i.uniqueName} is managed: writes are refused`);const r=[],s=h=>(h??"").replace(/\/+$/,"").toLowerCase();if(!s((l=a.environment)==null?void 0:l.url))throw new Error("backup does not record its environment url");if(s(a.environment.url)!==s(d))throw new Error(`backup was taken in ${a.environment.name} (${a.environment.url}), not this environment (${d}): restore refused`);const o=await jt(t,i.id),u=(h,p)=>`${h}:${p}`,v=new Map(o.map(h=>[u(h.type,h.objectId),h])),_=[],w=new Set;for(const h of a.membership.filter(p=>!p.rootObjectId||p.rootObjectId===p.objectId)){const p=v.get(u(h.type,h.objectId)),g={type:h.type,id:h.objectId,name:h.name};p?h.type===ne.Entity&&h.behavior===0&&p.behavior!==0&&(_.push({kind:"remove",component:g,reason:"shell → back to all assets"}),_.push({kind:"add",component:g,doNotIncludeSubcomponents:!1,reason:"re-add with all subcomponents"}),w.add(h.objectId)):(_.push({kind:"add",component:g,doNotIncludeSubcomponents:h.behavior!==0,reason:"re-add removed component"}),h.type===ne.Entity&&h.behavior===0&&w.add(h.objectId))}for(const h of a.membership.filter(p=>p.rootObjectId&&p.rootObjectId!==p.objectId))v.has(u(h.type,h.objectId))||w.has(h.rootObjectId)||_.push({kind:"add",component:{type:h.type,id:h.objectId,name:h.name},doNotIncludeSubcomponents:!1,reason:"re-add removed subcomponent"});const[C,f]=await Promise.all([a.forms.length?Pt(t,a.forms.map(h=>h.id)):Promise.resolve([]),a.views.length?qt(t,a.views.map(h=>h.id)):Promise.resolve([])]),m=new Set;for(const h of a.forms){const p=C.find(g=>g.id===h.id);if(!p){r.push(`Form ${h.name} no longer exists; not restored.`);continue}p.formxml!==h.formxml&&(_.push({kind:"update-form",edit:{form:p,after:h.formxml,removed:[],kept:[],warnings:[]}}),m.add(p.table||h.table))}for(const h of a.views){const p=f.find(g=>g.id===h.id);if(!p){r.push(`View ${h.name} no longer exists; not restored.`);continue}p.fetchxml===h.fetchxml&&p.layoutxml===h.layoutxml||(_.push({kind:"update-view",edit:{view:p,after:{fetchxml:h.fetchxml,layoutxml:h.layoutxml},removed:[],warnings:[]}}),m.add(p.table||h.table))}return m.size&&_.push({kind:"publish",tables:[...m].filter(Boolean).sort()}),{solution:i,ops:_,notes:r}}function er(t){return[...new Set(t.split(/[\s,;]+/).map(a=>a.trim().toLowerCase()).filter(Boolean))]}function Pe(t,a,e){const d=e.toLowerCase();return t.some(i=>a?a.prefix.toLowerCase()===i||a.uniqueName.toLowerCase().startsWith(i):d.startsWith(`${i}_`))}const qe=t=>[...new Set(t.map(a=>a.name))].slice(0,4).join(", ")+(t.length>4?"…":"");function tr(t,a,e,d){var w,C;const i=(f,m)=>({cause:f,fixes:[{kind:"report",label:"Report only: open in maker portal",link:d,note:m}]}),r=t.root&&t.root.behavior===0?t.root:null,s=()=>r?{kind:"shell",label:`Convert table ${r.name} to a shell (remove + add without subcomponents)`,root:r}:null,o={kind:"remove",label:`Remove this ${_e(t.type).toLowerCase()} from the solution`},u=Pe(e,null,t.name),v=(f,...m)=>({cause:f,fixes:m.filter(l=>!!l)}),_=((C=(w=a.find(f=>f.id===t.id))==null?void 0:w.solution)==null?void 0:C.uniqueName)??"a managed solution";if(t.selfOwned&&t.type===ne.Entity)return v(`Table ${t.name} belongs to ${_}. Shipping it, even as a shell, needs that solution in the target.`,o,{kind:"report",label:"Report only: open in maker portal",link:d});if(t.selfOwned)return v(r?`${_e(t.type)} ${t.name} belongs to ${_} and came in with table ${r.name}, which is in the solution with all assets.`:`${_e(t.type)} ${t.name} belongs to ${_} and is included directly.`,s(),r?null:o);switch(t.type){case ne.Entity:return t.behavior===0?v(`Table added with all assets: its columns, forms and views come along, including ones that need ${qe(a)}.`,s()??{kind:"shell",label:`Convert table ${t.name} to a shell`,root:{...t,behavior:0}},o):v(`The table itself requires ${qe(a)}.`,o,{kind:"report",label:"Report only: open in maker portal",link:d});case ne.Attribute:return u?v(r?`Column ${t.name} comes with table ${r.name}, which is in the solution with all assets.`:`Column ${t.name} is included directly.`,s(),r?null:o):i(`Your column needs ${qe(a)} (for example a lookup to that table). This is a real dependency: the target needs the app, or the column has to be changed by hand.`);case ne.Relationship:case ne.EntityRelationship:return i(`Relationship to ${qe(a)}. This is a real dependency: the target needs the app, or the relationship has to be deleted by hand.`);case ne.Form:return v(`Form uses ${qe(a)} (a field, subgrid, quick view or library).`,{kind:"edit-form",label:"Edit form: remove those fields (backup first)"},s(),r?null:o);case ne.View:return v(`View uses ${qe(a)} (a column, condition or link-entity).`,{kind:"edit-view",label:"Edit view: strip those columns and link-entities (backup first)"},s(),r?null:o);default:return i(`${_e(t.type)} references ${qe(a)}. Not edited automatically in v1.`,"Sitemap, app, ribbon, chart, process, web resource and plugin step references are fixed by hand.")}}const nr=4,Ht=new Set(["default","active","basic"]),rr=new Set([ne.Entity,ne.Attribute,ne.OptionSet,ne.Relationship,ne.EntityRelationship,ne.WebResource]);class Gt extends Error{constructor(){super("Diagnosis cancelled")}}const Ae=(t,a)=>`${t}:${a}`;async function ir(t){var F;const a=t.cancelled??(()=>!1),e=await jt(t.api,t.solution.id),d=new Set(e.map(A=>A.objectId)),i=new Map(e.map(A=>[A.rowId,A])),r=[],s=new Map;let o=0;if((F=t.onProgress)==null||F.call(t,0,e.length),await Tn(e,nr,async A=>{var E;const B=Ae(A.type,A.objectId);let K=t.reqCache.get(B);if(!K)try{K=await jn(t.api,A.objectId,A.type),t.reqCache.set(B,K)}catch(T){r.push({component:B,error:T.message??String(T)}),K=[]}s.set(A,K.filter(T=>T.requiredId&&T.requiredId!==A.objectId)),(E=t.onProgress)==null||E.call(t,++o,e.length)},a),a())throw new Gt;const u=[...new Set([...s.values()].flat().map(A=>A.requiredId).concat(e.map(A=>A.objectId)))],v=u.length?await Dn(t.api,u):new Map,_=new Map(t.allSolutions.map(A=>[A.id,A])),w=A=>({uniqueName:A.uniqueName,friendlyName:A.friendlyName,prefix:A.prefix,isManaged:A.isManaged}),C=A=>(v.get(A)??[]).map(B=>_.get(B)).filter(B=>!!B&&B.isManaged&&B.id!==t.solution.id&&!Ht.has(B.uniqueName.toLowerCase())),f=A=>A.uniqueName.toLowerCase()==="system",m=t.allSolutions.find(f)??{id:"",uniqueName:"System",friendlyName:"System",version:"",isManaged:!0,publisherId:null,prefix:""},l=new Map;for(const A of s.values())for(const B of A)B.requiredBaseSolutionId&&!l.has(B.requiredId)&&l.set(B.requiredId,B.requiredBaseSolutionId);const h=e.map(A=>{const B=A.rootRowId?i.get(A.rootRowId):void 0;return{type:A.type,id:A.objectId,parentId:(B==null?void 0:B.type)===ne.Entity?B.objectId:null}});for(const A of s.values())for(const B of A)h.push({type:B.requiredType,id:B.requiredId,parentId:B.requiredParentId});const p=new Map,g=await Ln(t.api,t.meta,h,p),k=[];p.size&&k.push(`Name lookup failed for ${p.size} component(s) (${[...new Set(p.values())].slice(0,2).join("; ")}). Findings that involve them are report only: an edit keyed on an unresolved name would change nothing. Run Diagnose again.`);const y=(A,B)=>g.get(Ae(A,B))??{type:A,id:B,name:B},x=A=>{var B,K,E,T;return A.type===ne.Entity?((K=(B=t.meta.entities)==null?void 0:B.get(A.id))==null?void 0:K.isCustom)??null:A.type===ne.Attribute&&A.table?((T=(E=t.meta.attributes.get(A.table))==null?void 0:E.find(c=>c.id===A.id))==null?void 0:T.isCustom)??null:null},z=(A,B)=>{var R,O;const K=C(A.id),E=_.get(B??l.get(A.id)??""),T=x(A),c=(J=m)=>({owner:J,candidates:K,platform:!0});if(E!=null&&E.isManaged&&!Ht.has(E.uniqueName.toLowerCase()))return f(E)?c(E):{owner:E,candidates:K,platform:!1};if(T===!1)return c();const D=K.find(f);if(D&&T===null)return c(D);const Q=K.filter(J=>!f(J));if(Q.length<=1)return{owner:Q[0]??null,candidates:K,platform:!1};const q=rr.has(A.type)?(O=(R=/^([a-z0-9]+)_/i.exec(A.name))==null?void 0:R[1])==null?void 0:O.toLowerCase():void 0,re=q?Q.find(J=>J.prefix===q):void 0,M=Q.filter(J=>Pe(t.filter,J,A.name));return{owner:re??(M.length===Q.length?Q[0]:Q.find(J=>!Pe(t.filter,J,A.name))),candidates:K,platform:!1}};for(const A of e){const B=y(A.type,A.objectId);A.name=B.name,A.table=B.table;const K=z(B,null).owner;A.filteredOwner=K&&Pe(t.filter,K,B.name)?K.uniqueName:null}const I=[];for(const[A,B]of s){const K=[],E=new Set,T={requiredId:A.objectId,requiredType:A.type,requiredParentId:null,requiredBaseSolutionId:null},c=[T,...B];let D=!1;for(const R of c){const O=Ae(R.requiredType,R.requiredId);if(E.has(O))continue;E.add(O);const J=y(R.requiredType,R.requiredId),{owner:V,candidates:G,platform:fe}=z(J,R.requiredBaseSolutionId);if(!V&&d.has(R.requiredId)||R===T&&!V)continue;const we=!fe&&Pe(t.filter,V,J.name),oe=de=>{var ke;return!!((ke=t.targetSolutions)!=null&&ke.has(de.uniqueName.toLowerCase()))},ae=!!V&&(fe||oe(V)||G.some(oe)),ge=!!t.targetSolutions&&!!V&&!ae;!we&&!ge||(R===T&&(D=!0),K.push({...J,solution:V?w(V):null,solutions:G.map(de=>de.uniqueName),blocker:!ae}))}if(!K.length)continue;const Q=y(A.type,A.objectId),q=A.type===ne.Entity?A:A.rootRowId?i.get(A.rootRowId):void 0,re=q&&q.type===ne.Entity?{...y(q.type,q.objectId),behavior:q.behavior??0}:null,M=[...new Set([Ae(A.type,A.objectId),...K.map(R=>Ae(R.type,R.id))].map(R=>p.get(R)).filter(R=>!!R))],te=M.length?{cause:`Some names could not be read (${M.join("; ")}), so this cannot be fixed automatically. Run Diagnose again.`,fixes:[{kind:"report",label:"Report only: open in maker portal",link:t.link(Q),note:"Name lookup failed: not edited automatically."}]}:tr({...Q,behavior:A.behavior,root:re,selfOwned:D},K,t.filter,t.link(Q));I.push({key:Ae(A.type,A.objectId),dependent:{...Q,rootBehavior:(re==null?void 0:re.behavior)??null,rootTable:re==null?void 0:re.name,selfOwned:D},required:K.map(({blocker:R,...O})=>O),cause:te.cause,fixes:te.fixes,status:K.some(R=>R.blocker)?"blocker":"safe"})}return I.sort((A,B)=>(A.status===B.status?0:A.status==="blocker"?-1:1)||A.dependent.type-B.dependent.type||A.dependent.name.localeCompare(B.dependent.name)),{solution:t.solution,environment:t.environment,target:t.target,filter:t.filter,components:e,findings:I,errors:r,warnings:k,takenAt:new Date().toISOString()}}function Kt(t){let a=t==null?"":String(t);return/^[=+\-@\t\r]/.test(a)&&(a=`'${a}`),/[",\r\n]/.test(a)?`"${a.replace(/"/g,'""')}"`:a}function or(t){var e;const a=[["status","dependent type","dependent","table","cause","required type","required","required solution","fixes"].map(Kt).join(",")];for(const d of t.findings)for(const i of d.required)a.push([d.status,_e(d.dependent.type),d.dependent.name,d.dependent.table??d.dependent.rootTable??"",d.cause,_e(i.type),i.name,((e=i.solution)==null?void 0:e.uniqueName)??"",d.fixes.map(r=>r.kind).join(" | ")].map(Kt).join(","));return a.join(`
|
|
4
|
+
`)+`
|
|
5
|
+
`}function sr(t){return JSON.stringify({kind:"sss-dependency-cleaner-findings",version:1,takenAt:t.takenAt,environment:t.environment,target:t.target,solution:{uniqueName:t.solution.uniqueName,friendlyName:t.solution.friendlyName,version:t.solution.version},filter:t.filter,findings:t.findings,errors:t.errors,warnings:t.warnings},null,2)}const Vt=t=>t.replace(/[^a-z0-9._-]+/gi,"_").replace(/^_+|_+$/g,"")||"solution";var ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ar(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function dt(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Yt={exports:{}};/*!
|
|
6
|
+
|
|
7
|
+
JSZip v3.10.2 - A JavaScript class for generating and reading zip files
|
|
8
|
+
<http://stuartk.com/jszip>
|
|
9
|
+
|
|
10
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
11
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
12
|
+
|
|
13
|
+
JSZip uses the library pako released under the MIT license :
|
|
14
|
+
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
15
|
+
*/(function(t,a){(function(e){t.exports=e()})(function(){return function e(d,i,r){function s(v,_){if(!i[v]){if(!d[v]){var w=typeof dt=="function"&&dt;if(!_&&w)return w(v,!0);if(o)return o(v,!0);var C=new Error("Cannot find module '"+v+"'");throw C.code="MODULE_NOT_FOUND",C}var f=i[v]={exports:{}};d[v][0].call(f.exports,function(m){var l=d[v][1][m];return s(l||m)},f,f.exports,e,d,i,r)}return i[v].exports}for(var o=typeof dt=="function"&&dt,u=0;u<r.length;u++)s(r[u]);return s}({1:[function(e,d,i){var r=e("./utils"),s=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(u){for(var v,_,w,C,f,m,l,h=[],p=0,g=u.length,k=g,y=r.getTypeOf(u)!=="string";p<u.length;)k=g-p,w=y?(v=u[p++],_=p<g?u[p++]:0,p<g?u[p++]:0):(v=u.charCodeAt(p++),_=p<g?u.charCodeAt(p++):0,p<g?u.charCodeAt(p++):0),C=v>>2,f=(3&v)<<4|_>>4,m=1<k?(15&_)<<2|w>>6:64,l=2<k?63&w:64,h.push(o.charAt(C)+o.charAt(f)+o.charAt(m)+o.charAt(l));return h.join("")},i.decode=function(u){var v,_,w,C,f,m,l=0,h=0,p="data:";if(u.substr(0,p.length)===p)throw new Error("Invalid base64 input, it looks like a data url.");var g,k=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===o.charAt(64)&&k--,u.charAt(u.length-2)===o.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(g=s.uint8array?new Uint8Array(0|k):new Array(0|k);l<u.length;)v=o.indexOf(u.charAt(l++))<<2|(C=o.indexOf(u.charAt(l++)))>>4,_=(15&C)<<4|(f=o.indexOf(u.charAt(l++)))>>2,w=(3&f)<<6|(m=o.indexOf(u.charAt(l++))),g[h++]=v,f!==64&&(g[h++]=_),m!==64&&(g[h++]=w);return g}},{"./support":30,"./utils":32}],2:[function(e,d,i){var r=e("./external"),s=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),u=e("./stream/DataLengthProbe");function v(_,w,C,f,m){this.compressedSize=_,this.uncompressedSize=w,this.crc32=C,this.compression=f,this.compressedContent=m}v.prototype={getContentWorker:function(){var _=new s(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),w=this;return _.on("end",function(){if(this.streamInfo.data_length!==w.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),_},getCompressedWorker:function(){return new s(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},v.createWorkerFrom=function(_,w,C){return _.pipe(new o).pipe(new u("uncompressedSize")).pipe(w.compressWorker(C)).pipe(new u("compressedSize")).withStreamInfo("compression",w)},d.exports=v},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,d,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,d,i){var r=e("./utils"),s=function(){for(var o,u=[],v=0;v<256;v++){o=v;for(var _=0;_<8;_++)o=1&o?3988292384^o>>>1:o>>>1;u[v]=o}return u}();d.exports=function(o,u){return o!==void 0&&o.length?r.getTypeOf(o)!=="string"?function(v,_,w,C){var f=s,m=C+w;v^=-1;for(var l=C;l<m;l++)v=v>>>8^f[255&(v^_[l])];return-1^v}(0|u,o,o.length,0):function(v,_,w,C){var f=s,m=C+w;v^=-1;for(var l=C;l<m;l++)v=v>>>8^f[255&(v^_.charCodeAt(l))];return-1^v}(0|u,o,o.length,0):0}},{"./utils":32}],5:[function(e,d,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,d,i){var r=null;r=typeof Promise<"u"?Promise:e("lie"),d.exports={Promise:r}},{lie:37}],7:[function(e,d,i){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=e("pako"),o=e("./utils"),u=e("./stream/GenericWorker"),v=r?"uint8array":"array";function _(w,C){u.call(this,"FlateWorker/"+w),this._pako=null,this._pakoAction=w,this._pakoOptions=C,this.meta={}}i.magic="\b\0",o.inherits(_,u),_.prototype.processChunk=function(w){this.meta=w.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(v,w.data),!1)},_.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},_.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},_.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var w=this;this._pako.onData=function(C){w.push({data:C,meta:w.meta})}},i.compressWorker=function(w){return new _("Deflate",w)},i.uncompressWorker=function(){return new _("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,d,i){function r(f,m){var l,h="";for(l=0;l<m;l++)h+=String.fromCharCode(255&f),f>>>=8;return h}function s(f,m,l,h,p,g){var k,y,x=f.file,z=f.compression,I=g!==v.utf8encode,F=o.transformTo("string",g(x.name)),A=o.transformTo("string",v.utf8encode(x.name)),B=x.comment,K=o.transformTo("string",g(B)),E=o.transformTo("string",v.utf8encode(B)),T=A.length!==x.name.length,c=E.length!==B.length,D="",Q="",q="",re=x.dir,M=x.date,te={crc32:0,compressedSize:0,uncompressedSize:0};m&&!l||(te.crc32=f.crc32,te.compressedSize=f.compressedSize,te.uncompressedSize=f.uncompressedSize);var R=0;m&&(R|=8),I||!T&&!c||(R|=2048);var O=0,J=0;re&&(O|=16),p==="UNIX"?(J=798,O|=function(G,fe){var we=G;return G||(we=fe?16893:33204),(65535&we)<<16}(x.unixPermissions,re)):(J=20,O|=function(G){return 63&(G||0)}(x.dosPermissions)),k=M.getUTCHours(),k<<=6,k|=M.getUTCMinutes(),k<<=5,k|=M.getUTCSeconds()/2,y=M.getUTCFullYear()-1980,y<<=4,y|=M.getUTCMonth()+1,y<<=5,y|=M.getUTCDate(),T&&(Q=r(1,1)+r(_(F),4)+A,D+="up"+r(Q.length,2)+Q),c&&(q=r(1,1)+r(_(K),4)+E,D+="uc"+r(q.length,2)+q);var V="";return V+=`
|
|
16
|
+
\0`,V+=r(R,2),V+=z.magic,V+=r(k,2),V+=r(y,2),V+=r(te.crc32,4),V+=r(te.compressedSize,4),V+=r(te.uncompressedSize,4),V+=r(F.length,2),V+=r(D.length,2),{fileRecord:w.LOCAL_FILE_HEADER+V+F+D,dirRecord:w.CENTRAL_FILE_HEADER+r(J,2)+V+r(K.length,2)+"\0\0\0\0"+r(O,4)+r(h,4)+F+D+K}}var o=e("../utils"),u=e("../stream/GenericWorker"),v=e("../utf8"),_=e("../crc32"),w=e("../signature");function C(f,m,l,h){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=l,this.encodeFileName=h,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(C,u),C.prototype.push=function(f){var m=f.meta.percent||0,l=this.entriesCount,h=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,u.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:l?(m+100*(l-h-1))/l:100}}))},C.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var m=this.streamFiles&&!f.file.dir;if(m){var l=s(f,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:l.fileRecord,meta:{percent:0}})}else this.accumulate=!0},C.prototype.closedSource=function(f){this.accumulate=!1;var m=this.streamFiles&&!f.file.dir,l=s(f,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(l.dirRecord),m)this.push({data:function(h){return w.DATA_DESCRIPTOR+r(h.crc32,4)+r(h.compressedSize,4)+r(h.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:l.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},C.prototype.flush=function(){for(var f=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var l=this.bytesWritten-f,h=function(p,g,k,y,x){var z=o.transformTo("string",x(y));return w.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(p,2)+r(p,2)+r(g,4)+r(k,4)+r(z.length,2)+z}(this.dirRecords.length,l,f,this.zipComment,this.encodeFileName);this.push({data:h,meta:{percent:100}})},C.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},C.prototype.registerPrevious=function(f){this._sources.push(f);var m=this;return f.on("data",function(l){m.processChunk(l)}),f.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),f.on("error",function(l){m.error(l)}),this},C.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},C.prototype.error=function(f){var m=this._sources;if(!u.prototype.error.call(this,f))return!1;for(var l=0;l<m.length;l++)try{m[l].error(f)}catch{}return!0},C.prototype.lock=function(){u.prototype.lock.call(this);for(var f=this._sources,m=0;m<f.length;m++)f[m].lock()},d.exports=C},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,d,i){var r=e("../compressions"),s=e("./ZipFileWorker");i.generateWorker=function(o,u,v){var _=new s(u.streamFiles,v,u.platform,u.encodeFileName),w=0;try{o.forEach(function(C,f){w++;var m=function(g,k){var y=g||k,x=r[y];if(!x)throw new Error(y+" is not a valid compression method !");return x}(f.options.compression,u.compression),l=f.options.compressionOptions||u.compressionOptions||{},h=f.dir,p=f.date;f._compressWorker(m,l).withStreamInfo("file",{name:C,dir:h,date:p,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(_)}),_.entriesCount=w}catch(C){_.error(C)}return _}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,d,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new r;for(var o in this)typeof this[o]!="function"&&(s[o]=this[o]);return s}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.2",r.loadAsync=function(s,o){return new r().loadAsync(s,o)},r.external=e("./external"),d.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,d,i){var r=e("./utils"),s=e("./external"),o=e("./utf8"),u=e("./zipEntries"),v=e("./stream/Crc32Probe"),_=e("./nodejsUtils");function w(C){return new s.Promise(function(f,m){var l=C.decompressed.getContentWorker().pipe(new v);l.on("error",function(h){m(h)}).on("end",function(){l.streamInfo.crc32!==C.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}d.exports=function(C,f){var m=this;return f=r.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),_.isNode&&_.isStream(C)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",C,!0,f.optimizedBinaryString,f.base64).then(function(l){var h=new u(f);return h.load(l),h}).then(function(l){var h=[s.Promise.resolve(l)],p=l.files;if(f.checkCRC32)for(var g=0;g<p.length;g++)h.push(w(p[g]));return s.Promise.all(h)}).then(function(l){for(var h=l.shift(),p=h.files,g=0;g<p.length;g++){var k=p[g],y=k.fileNameStr,x=r.resolve(k.fileNameStr);m.file(x,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:f.createFolders}),k.dir||(m.file(x).unsafeOriginalName=y)}return h.zipComment.length&&(m.comment=h.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,d,i){var r=e("../utils"),s=e("../stream/GenericWorker");function o(u,v){s.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(v)}r.inherits(o,s),o.prototype._bindStream=function(u){var v=this;(this._stream=u).pause(),u.on("data",function(_){v.push({data:_,meta:{percent:0}})}).on("error",function(_){v.isPaused?this.generatedError=_:v.error(_)}).on("end",function(){v.isPaused?v._upstreamEnded=!0:v.end()})},o.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},d.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,d,i){var r=e("readable-stream").Readable;function s(o,u,v){r.call(this,u),this._helper=o;var _=this;o.on("data",function(w,C){_.push(w)||_._helper.pause(),v&&v(C)}).on("error",function(w){_.emit("error",w)}).on("end",function(){_.push(null)})}e("../utils").inherits(s,r),s.prototype._read=function(){this._helper.resume()},d.exports=s},{"../utils":32,"readable-stream":16}],14:[function(e,d,i){d.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,s);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,s)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var s=new Buffer(r);return s.fill(0),s},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(e,d,i){function r(x,z,I){var F,A=o.getTypeOf(z),B=o.extend(I||{},_);B.date=B.date||new Date,B.compression!==null&&(B.compression=B.compression.toUpperCase()),typeof B.unixPermissions=="string"&&(B.unixPermissions=parseInt(B.unixPermissions,8)),B.unixPermissions&&16384&B.unixPermissions&&(B.dir=!0),B.dosPermissions&&16&B.dosPermissions&&(B.dir=!0),B.dir&&(x=p(x)),B.createFolders&&(F=h(x))&&g.call(this,F,!0);var K=A==="string"&&B.binary===!1&&B.base64===!1;I&&I.binary!==void 0||(B.binary=!K),(z instanceof w&&z.uncompressedSize===0||B.dir||!z||z.length===0)&&(B.base64=!1,B.binary=!0,z="",B.compression="STORE",A="string");var E=null;E=z instanceof w||z instanceof u?z:m.isNode&&m.isStream(z)?new l(x,z):o.prepareContent(x,z,B.binary,B.optimizedBinaryString,B.base64);var T=new C(x,E,B);this.files[x]=T}var s=e("./utf8"),o=e("./utils"),u=e("./stream/GenericWorker"),v=e("./stream/StreamHelper"),_=e("./defaults"),w=e("./compressedObject"),C=e("./zipObject"),f=e("./generate"),m=e("./nodejsUtils"),l=e("./nodejs/NodejsStreamInputAdapter"),h=function(x){x.slice(-1)==="/"&&(x=x.substring(0,x.length-1));var z=x.lastIndexOf("/");return 0<z?x.substring(0,z):""},p=function(x){return x.slice(-1)!=="/"&&(x+="/"),x},g=function(x,z){return z=z!==void 0?z:_.createFolders,x=p(x),this.files[x]||r.call(this,x,null,{dir:!0,createFolders:z}),this.files[x]};function k(x){return Object.prototype.toString.call(x)==="[object RegExp]"}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(x){var z,I,F;for(z in this.files)F=this.files[z],(I=z.slice(this.root.length,z.length))&&z.slice(0,this.root.length)===this.root&&x(I,F)},filter:function(x){var z=[];return this.forEach(function(I,F){x(I,F)&&z.push(F)}),z},file:function(x,z,I){if(arguments.length!==1)return x=this.root+x,r.call(this,x,z,I),this;if(k(x)){var F=x;return this.filter(function(B,K){return!K.dir&&F.test(B)})}var A=this.files[this.root+x];return A&&!A.dir?A:null},folder:function(x){if(!x)return this;if(k(x))return this.filter(function(A,B){return B.dir&&x.test(A)});var z=this.root+x,I=g.call(this,z),F=this.clone();return F.root=I.name,F},remove:function(x){x=this.root+x;var z=this.files[x];if(z||(x.slice(-1)!=="/"&&(x+="/"),z=this.files[x]),z&&!z.dir)delete this.files[x];else for(var I=this.filter(function(A,B){return B.name.slice(0,x.length)===x}),F=0;F<I.length;F++)delete this.files[I[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(x){var z,I={};try{if((I=o.extend(x||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=I.type.toLowerCase(),I.compression=I.compression.toUpperCase(),I.type==="binarystring"&&(I.type="string"),!I.type)throw new Error("No output type specified.");o.checkSupport(I.type),I.platform!=="darwin"&&I.platform!=="freebsd"&&I.platform!=="linux"&&I.platform!=="sunos"||(I.platform="UNIX"),I.platform==="win32"&&(I.platform="DOS");var F=I.comment||this.comment||"";z=f.generateWorker(this,I,F)}catch(A){(z=new u("error")).error(A)}return new v(z,I.type||"string",I.mimeType)},generateAsync:function(x,z){return this.generateInternalStream(x).accumulate(z)},generateNodeStream:function(x,z){return(x=x||{}).type||(x.type="nodebuffer"),this.generateInternalStream(x).toNodejsStream(z)}};d.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,d,i){d.exports=e("stream")},{stream:void 0}],17:[function(e,d,i){var r=e("./DataReader");function s(o){r.call(this,o);for(var u=0;u<this.data.length;u++)o[u]=255&o[u]}e("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data[this.zero+o]},s.prototype.lastIndexOfSignature=function(o){for(var u=o.charCodeAt(0),v=o.charCodeAt(1),_=o.charCodeAt(2),w=o.charCodeAt(3),C=this.length-4;0<=C;--C)if(this.data[C]===u&&this.data[C+1]===v&&this.data[C+2]===_&&this.data[C+3]===w)return C-this.zero;return-1},s.prototype.readAndCheckSignature=function(o){var u=o.charCodeAt(0),v=o.charCodeAt(1),_=o.charCodeAt(2),w=o.charCodeAt(3),C=this.readData(4);return u===C[0]&&v===C[1]&&_===C[2]&&w===C[3]},s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},d.exports=s},{"../utils":32,"./DataReader":18}],18:[function(e,d,i){var r=e("../utils");function s(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var u,v=0;for(this.checkOffset(o),u=this.index+o-1;u>=this.index;u--)v=(v<<8)+this.byteAt(u);return this.index+=o,v},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},d.exports=s},{"../utils":32}],19:[function(e,d,i){var r=e("./Uint8ArrayReader");function s(o){r.call(this,o)}e("../utils").inherits(s,r),s.prototype.readData=function(o){this.checkOffset(o);var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},d.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,d,i){var r=e("./DataReader");function s(o){r.call(this,o)}e("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},s.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},s.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},s.prototype.readData=function(o){this.checkOffset(o);var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},d.exports=s},{"../utils":32,"./DataReader":18}],21:[function(e,d,i){var r=e("./ArrayReader");function s(o){r.call(this,o)}e("../utils").inherits(s,r),s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},d.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(e,d,i){var r=e("../utils"),s=e("../support"),o=e("./ArrayReader"),u=e("./StringReader"),v=e("./NodeBufferReader"),_=e("./Uint8ArrayReader");d.exports=function(w){var C=r.getTypeOf(w);return r.checkSupport(C),C!=="string"||s.uint8array?C==="nodebuffer"?new v(w):s.uint8array?new _(r.transformTo("uint8array",w)):new o(r.transformTo("array",w)):new u(w)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,d,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,d,i){var r=e("./GenericWorker"),s=e("../utils");function o(u){r.call(this,"ConvertWorker to "+u),this.destType=u}s.inherits(o,r),o.prototype.processChunk=function(u){this.push({data:s.transformTo(this.destType,u.data),meta:u.meta})},d.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,d,i){var r=e("./GenericWorker"),s=e("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,r),o.prototype.processChunk=function(u){this.streamInfo.crc32=s(u.data,this.streamInfo.crc32||0),this.push(u)},d.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,d,i){var r=e("../utils"),s=e("./GenericWorker");function o(u){s.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}r.inherits(o,s),o.prototype.processChunk=function(u){if(u){var v=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=v+u.data.length}s.prototype.processChunk.call(this,u)},d.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,d,i){var r=e("../utils"),s=e("./GenericWorker");function o(u){s.call(this,"DataWorker");var v=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(_){v.dataIsReady=!0,v.data=_,v.max=_&&_.length||0,v.type=r.getTypeOf(_),v.isPaused||v._tickAndRepeat()},function(_){v.error(_)})}r.inherits(o,s),o.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,v=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,v);break;case"uint8array":u=this.data.subarray(this.index,v);break;case"array":case"nodebuffer":u=this.data.slice(this.index,v)}return this.index=v,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},d.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,d,i){function r(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,o){return this._listeners[s].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,o){if(this._listeners[s])for(var u=0;u<this._listeners[s].length;u++)this._listeners[s][u].call(this,o)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var o=this;return s.on("data",function(u){o.processChunk(u)}),s.on("end",function(){o.end()}),s.on("error",function(u){o.error(u)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,o){return this.extraStreamInfo[s]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},d.exports=r},{}],29:[function(e,d,i){var r=e("../utils"),s=e("./ConvertWorker"),o=e("./GenericWorker"),u=e("../base64"),v=e("../support"),_=e("../external"),w=null;if(v.nodestream)try{w=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function C(m,l){return new _.Promise(function(h,p){var g=[],k=m._internalType,y=m._outputType,x=m._mimeType;m.on("data",function(z,I){g.push(z),l&&l(I)}).on("error",function(z){g=[],p(z)}).on("end",function(){try{var z=function(I,F,A){switch(I){case"blob":return r.newBlob(r.transformTo("arraybuffer",F),A);case"base64":return u.encode(F);default:return r.transformTo(I,F)}}(y,function(I,F){var A,B=0,K=null,E=0;for(A=0;A<F.length;A++)E+=F[A].length;switch(I){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(K=new Uint8Array(E),A=0;A<F.length;A++)K.set(F[A],B),B+=F[A].length;return K;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+I+"'")}}(k,g),x);h(z)}catch(I){p(I)}g=[]}).resume()})}function f(m,l,h){var p=l;switch(l){case"blob":case"arraybuffer":p="uint8array";break;case"base64":p="string"}try{this._internalType=p,this._outputType=l,this._mimeType=h,r.checkSupport(p),this._worker=m.pipe(new s(p)),m.lock()}catch(g){this._worker=new o("error"),this._worker.error(g)}}f.prototype={accumulate:function(m){return C(this,m)},on:function(m,l){var h=this;return m==="data"?this._worker.on(m,function(p){l.call(h,p.data,p.meta)}):this._worker.on(m,function(){r.delay(l,arguments,h)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new w(this,{objectMode:this._outputType!=="nodebuffer"},m)}},d.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,d,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(r),i.blob=s.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(e,d,i){for(var r=e("./utils"),s=e("./support"),o=e("./nodejsUtils"),u=e("./stream/GenericWorker"),v=new Array(256),_=0;_<256;_++)v[_]=252<=_?6:248<=_?5:240<=_?4:224<=_?3:192<=_?2:1;v[254]=v[254]=1;function w(){u.call(this,"utf-8 decode"),this.leftOver=null}function C(){u.call(this,"utf-8 encode")}i.utf8encode=function(f){return s.nodebuffer?o.newBufferFrom(f,"utf-8"):function(m){var l,h,p,g,k,y=m.length,x=0;for(g=0;g<y;g++)(64512&(h=m.charCodeAt(g)))==55296&&g+1<y&&(64512&(p=m.charCodeAt(g+1)))==56320&&(h=65536+(h-55296<<10)+(p-56320),g++),x+=h<128?1:h<2048?2:h<65536?3:4;for(l=s.uint8array?new Uint8Array(x):new Array(x),g=k=0;k<x;g++)(64512&(h=m.charCodeAt(g)))==55296&&g+1<y&&(64512&(p=m.charCodeAt(g+1)))==56320&&(h=65536+(h-55296<<10)+(p-56320),g++),h<128?l[k++]=h:(h<2048?l[k++]=192|h>>>6:(h<65536?l[k++]=224|h>>>12:(l[k++]=240|h>>>18,l[k++]=128|h>>>12&63),l[k++]=128|h>>>6&63),l[k++]=128|63&h);return l}(f)},i.utf8decode=function(f){return s.nodebuffer?r.transformTo("nodebuffer",f).toString("utf-8"):function(m){var l,h,p,g,k=m.length,y=new Array(2*k);for(l=h=0;l<k;)if((p=m[l++])<128)y[h++]=p;else if(4<(g=v[p]))y[h++]=65533,l+=g-1;else{for(p&=g===2?31:g===3?15:7;1<g&&l<k;)p=p<<6|63&m[l++],g--;1<g?y[h++]=65533:p<65536?y[h++]=p:(p-=65536,y[h++]=55296|p>>10&1023,y[h++]=56320|1023&p)}return y.length!==h&&(y.subarray?y=y.subarray(0,h):y.length=h),r.applyFromCharCode(y)}(f=r.transformTo(s.uint8array?"uint8array":"array",f))},r.inherits(w,u),w.prototype.processChunk=function(f){var m=r.transformTo(s.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var l=m;(m=new Uint8Array(l.length+this.leftOver.length)).set(this.leftOver,0),m.set(l,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var h=function(g,k){var y;for((k=k||g.length)>g.length&&(k=g.length),y=k-1;0<=y&&(192&g[y])==128;)y--;return y<0||y===0?k:y+v[g[y]]>k?y:k}(m),p=m;h!==m.length&&(s.uint8array?(p=m.subarray(0,h),this.leftOver=m.subarray(h,m.length)):(p=m.slice(0,h),this.leftOver=m.slice(h,m.length))),this.push({data:i.utf8decode(p),meta:f.meta})},w.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=w,r.inherits(C,u),C.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=C},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,d,i){var r=e("./support"),s=e("./base64"),o=e("./nodejsUtils"),u=e("./external");function v(l){return l}function _(l,h){for(var p=0;p<l.length;++p)h[p]=255&l.charCodeAt(p);return h}e("setimmediate"),i.newBlob=function(l,h){i.checkSupport("blob");try{return new Blob([l],{type:h})}catch{try{var p=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return p.append(l),p.getBlob(h)}catch{throw new Error("Bug : can't construct the Blob.")}}};var w={stringifyByChunk:function(l,h,p){var g=[],k=0,y=l.length;if(y<=p)return String.fromCharCode.apply(null,l);for(;k<y;)h==="array"||h==="nodebuffer"?g.push(String.fromCharCode.apply(null,l.slice(k,Math.min(k+p,y)))):g.push(String.fromCharCode.apply(null,l.subarray(k,Math.min(k+p,y)))),k+=p;return g.join("")},stringifyByChar:function(l){for(var h="",p=0;p<l.length;p++)h+=String.fromCharCode(l[p]);return h},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}}()}};function C(l){var h=65536,p=i.getTypeOf(l),g=!0;if(p==="uint8array"?g=w.applyCanBeUsed.uint8array:p==="nodebuffer"&&(g=w.applyCanBeUsed.nodebuffer),g)for(;1<h;)try{return w.stringifyByChunk(l,p,h)}catch{h=Math.floor(h/2)}return w.stringifyByChar(l)}function f(l,h){for(var p=0;p<l.length;p++)h[p]=l[p];return h}i.applyFromCharCode=C;var m={};m.string={string:v,array:function(l){return _(l,new Array(l.length))},arraybuffer:function(l){return m.string.uint8array(l).buffer},uint8array:function(l){return _(l,new Uint8Array(l.length))},nodebuffer:function(l){return _(l,o.allocBuffer(l.length))}},m.array={string:C,array:v,arraybuffer:function(l){return new Uint8Array(l).buffer},uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(l)}},m.arraybuffer={string:function(l){return C(new Uint8Array(l))},array:function(l){return f(new Uint8Array(l),new Array(l.byteLength))},arraybuffer:v,uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(new Uint8Array(l))}},m.uint8array={string:C,array:function(l){return f(l,new Array(l.length))},arraybuffer:function(l){return l.buffer},uint8array:v,nodebuffer:function(l){return o.newBufferFrom(l)}},m.nodebuffer={string:C,array:function(l){return f(l,new Array(l.length))},arraybuffer:function(l){return m.nodebuffer.uint8array(l).buffer},uint8array:function(l){return f(l,new Uint8Array(l.length))},nodebuffer:v},i.transformTo=function(l,h){if(h=h||"",!l)return h;i.checkSupport(l);var p=i.getTypeOf(h);return m[p][l](h)},i.resolve=function(l){for(var h=l.split("/"),p=[],g=0;g<h.length;g++){var k=h[g];k==="."||k===""&&g!==0&&g!==h.length-1||(k===".."?p.pop():p.push(k))}return p.join("/")},i.getTypeOf=function(l){if(typeof l=="string")return"string";var h=Object.prototype.toString.call(l);return h==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(l)?"nodebuffer":r.uint8array&&h==="[object Uint8Array]"?"uint8array":r.arraybuffer&&h==="[object ArrayBuffer]"?"arraybuffer":void 0},i.checkSupport=function(l){if(!r[l.toLowerCase()])throw new Error(l+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(l){var h,p,g="";for(p=0;p<(l||"").length;p++)g+="\\x"+((h=l.charCodeAt(p))<16?"0":"")+h.toString(16).toUpperCase();return g},i.delay=function(l,h,p){setImmediate(function(){l.apply(p||null,h||[])})},i.inherits=function(l,h){function p(){}p.prototype=h.prototype,l.prototype=new p},i.extend=function(){var l,h,p={};for(l=0;l<arguments.length;l++)for(h in arguments[l])Object.prototype.hasOwnProperty.call(arguments[l],h)&&p[h]===void 0&&(p[h]=arguments[l][h]);return p},i.prepareContent=function(l,h,p,g,k){return u.Promise.resolve(h).then(function(y){return r.blob&&(y instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(y))!==-1)?Blob.prototype.arrayBuffer!==void 0?y.arrayBuffer():typeof FileReader<"u"?new u.Promise(function(x,z){var I=new FileReader;I.onload=function(F){x(F.target.result)},I.onerror=function(F){z(F.target.error)},I.readAsArrayBuffer(y)}):u.Promise.reject(new Error(l+" is a Blob, but we have no way of reading it.")):y}).then(function(y){var x=i.getTypeOf(y);return x?(x==="arraybuffer"?y=i.transformTo("uint8array",y):x==="string"&&(k?y=s.decode(y):p&&g!==!0&&(y=function(z){return _(z,r.uint8array?new Uint8Array(z.length):new Array(z.length))}(y))),y):u.Promise.reject(new Error("Can't read the data of '"+l+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,d,i){var r=e("./reader/readerFor"),s=e("./utils"),o=e("./signature"),u=e("./zipEntry"),v=e("./support");function _(w){this.files=[],this.loadOptions=w}_.prototype={checkSignature:function(w){if(!this.reader.readAndCheckSignature(w)){this.reader.index-=4;var C=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(C)+", expected "+s.pretty(w)+")")}},isSignature:function(w,C){var f=this.reader.index;this.reader.setIndex(w);var m=this.reader.readString(4)===C;return this.reader.setIndex(f),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var w=this.reader.readData(this.zipCommentLength),C=v.uint8array?"uint8array":"array",f=s.transformTo(C,w);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var w,C,f,m=this.zip64EndOfCentralSize-44;0<m;)w=this.reader.readInt(2),C=this.reader.readInt(4),f=this.reader.readData(C),this.zip64ExtensibleData[w]={id:w,length:C,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var w,C;for(w=0;w<this.files.length;w++)C=this.files[w],this.reader.setIndex(C.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),C.readLocalPart(this.reader),C.handleUTF8(),C.processAttributes()},readCentralDir:function(){var w;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(w=new u({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(w);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var w=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(w<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(w);var C=w;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(w=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(w),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var m=C-f;if(0<m)this.isSignature(C,o.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(w){this.reader=r(w)},load:function(w){this.prepareReader(w),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},d.exports=_},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,d,i){var r=e("./reader/readerFor"),s=e("./utils"),o=e("./compressedObject"),u=e("./crc32"),v=e("./utf8"),_=e("./compressions"),w=e("./support");function C(f,m){this.options=f,this.loadOptions=m}C.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var m,l;if(f.skip(22),this.fileNameLength=f.readInt(2),l=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(l),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=function(h){for(var p in _)if(Object.prototype.hasOwnProperty.call(_,p)&&_[p].magic===h)return _[p];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,m,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var m=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(m),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=r(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var m,l,h,p=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<p;)m=f.readInt(2),l=f.readInt(2),h=f.readData(l),this.extraFields[m]={id:m,length:l,value:h};f.setIndex(p)},handleUTF8:function(){var f=w.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=v.utf8decode(this.fileName),this.fileCommentStr=v.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var l=s.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(l)}var h=this.findExtraFieldUnicodeComment();if(h!==null)this.fileCommentStr=h;else{var p=s.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(p)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var m=r(f.value);return m.readInt(1)!==1||u(this.fileName)!==m.readInt(4)?null:v.utf8decode(m.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var m=r(f.value);return m.readInt(1)!==1||u(this.fileComment)!==m.readInt(4)?null:v.utf8decode(m.readData(f.length-5))}return null}},d.exports=C},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,d,i){function r(m,l,h){this.name=m,this.dir=h.dir,this.date=h.date,this.comment=h.comment,this.unixPermissions=h.unixPermissions,this.dosPermissions=h.dosPermissions,this._data=l,this._dataBinary=h.binary,this.options={compression:h.compression,compressionOptions:h.compressionOptions}}var s=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),u=e("./utf8"),v=e("./compressedObject"),_=e("./stream/GenericWorker");r.prototype={internalStream:function(m){var l=null,h="string";try{if(!m)throw new Error("No output type specified.");var p=(h=m.toLowerCase())==="string"||h==="text";h!=="binarystring"&&h!=="text"||(h="string"),l=this._decompressWorker();var g=!this._dataBinary;g&&!p&&(l=l.pipe(new u.Utf8EncodeWorker)),!g&&p&&(l=l.pipe(new u.Utf8DecodeWorker))}catch(k){(l=new _("error")).error(k)}return new s(l,h,"")},async:function(m,l){return this.internalStream(m).accumulate(l)},nodeStream:function(m,l){return this.internalStream(m||"nodebuffer").toNodejsStream(l)},_compressWorker:function(m,l){if(this._data instanceof v&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var h=this._decompressWorker();return this._dataBinary||(h=h.pipe(new u.Utf8EncodeWorker)),v.createWorkerFrom(h,m,l)},_decompressWorker:function(){return this._data instanceof v?this._data.getContentWorker():this._data instanceof _?this._data:new o(this._data)}};for(var w=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],C=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<w.length;f++)r.prototype[w[f]]=C;d.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,d,i){(function(r){var s,o,u=r.MutationObserver||r.WebKitMutationObserver;if(u){var v=0,_=new u(m),w=r.document.createTextNode("");_.observe(w,{characterData:!0}),s=function(){w.data=v=++v%2}}else if(r.setImmediate||r.MessageChannel===void 0)s="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var l=r.document.createElement("script");l.onreadystatechange=function(){m(),l.onreadystatechange=null,l.parentNode.removeChild(l),l=null},r.document.documentElement.appendChild(l)}:function(){setTimeout(m,0)};else{var C=new r.MessageChannel;C.port1.onmessage=m,s=function(){C.port2.postMessage(0)}}var f=[];function m(){var l,h;o=!0;for(var p=f.length;p;){for(h=f,f=[],l=-1;++l<p;)h[l]();p=f.length}o=!1}d.exports=function(l){f.push(l)!==1||o||s()}}).call(this,typeof ut<"u"?ut:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(e,d,i){var r=e("immediate");function s(){}var o={},u=["REJECTED"],v=["FULFILLED"],_=["PENDING"];function w(p){if(typeof p!="function")throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,p!==s&&l(this,p)}function C(p,g,k){this.promise=p,typeof g=="function"&&(this.onFulfilled=g,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function f(p,g,k){r(function(){var y;try{y=g(k)}catch(x){return o.reject(p,x)}y===p?o.reject(p,new TypeError("Cannot resolve promise with itself")):o.resolve(p,y)})}function m(p){var g=p&&p.then;if(p&&(typeof p=="object"||typeof p=="function")&&typeof g=="function")return function(){g.apply(p,arguments)}}function l(p,g){var k=!1;function y(I){k||(k=!0,o.reject(p,I))}function x(I){k||(k=!0,o.resolve(p,I))}var z=h(function(){g(x,y)});z.status==="error"&&y(z.value)}function h(p,g){var k={};try{k.value=p(g),k.status="success"}catch(y){k.status="error",k.value=y}return k}(d.exports=w).prototype.finally=function(p){if(typeof p!="function")return this;var g=this.constructor;return this.then(function(k){return g.resolve(p()).then(function(){return k})},function(k){return g.resolve(p()).then(function(){throw k})})},w.prototype.catch=function(p){return this.then(null,p)},w.prototype.then=function(p,g){if(typeof p!="function"&&this.state===v||typeof g!="function"&&this.state===u)return this;var k=new this.constructor(s);return this.state!==_?f(k,this.state===v?p:g,this.outcome):this.queue.push(new C(k,p,g)),k},C.prototype.callFulfilled=function(p){o.resolve(this.promise,p)},C.prototype.otherCallFulfilled=function(p){f(this.promise,this.onFulfilled,p)},C.prototype.callRejected=function(p){o.reject(this.promise,p)},C.prototype.otherCallRejected=function(p){f(this.promise,this.onRejected,p)},o.resolve=function(p,g){var k=h(m,g);if(k.status==="error")return o.reject(p,k.value);var y=k.value;if(y)l(p,y);else{p.state=v,p.outcome=g;for(var x=-1,z=p.queue.length;++x<z;)p.queue[x].callFulfilled(g)}return p},o.reject=function(p,g){p.state=u,p.outcome=g;for(var k=-1,y=p.queue.length;++k<y;)p.queue[k].callRejected(g);return p},w.resolve=function(p){return p instanceof this?p:o.resolve(new this(s),p)},w.reject=function(p){var g=new this(s);return o.reject(g,p)},w.all=function(p){var g=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=p.length,y=!1;if(!k)return this.resolve([]);for(var x=new Array(k),z=0,I=-1,F=new this(s);++I<k;)A(p[I],I);return F;function A(B,K){g.resolve(B).then(function(E){x[K]=E,++z!==k||y||(y=!0,o.resolve(F,x))},function(E){y||(y=!0,o.reject(F,E))})}},w.race=function(p){var g=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=p.length,y=!1;if(!k)return this.resolve([]);for(var x=-1,z=new this(s);++x<k;)I=p[x],g.resolve(I).then(function(F){y||(y=!0,o.resolve(z,F))},function(F){y||(y=!0,o.reject(z,F))});var I;return z}},{immediate:36}],38:[function(e,d,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),d.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,d,i){var r=e("./zlib/deflate"),s=e("./utils/common"),o=e("./utils/strings"),u=e("./zlib/messages"),v=e("./zlib/zstream"),_=Object.prototype.toString,w=0,C=-1,f=0,m=8;function l(p){if(!(this instanceof l))return new l(p);this.options=s.assign({level:C,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},p||{});var g=this.options;g.raw&&0<g.windowBits?g.windowBits=-g.windowBits:g.gzip&&0<g.windowBits&&g.windowBits<16&&(g.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new v,this.strm.avail_out=0;var k=r.deflateInit2(this.strm,g.level,g.method,g.windowBits,g.memLevel,g.strategy);if(k!==w)throw new Error(u[k]);if(g.header&&r.deflateSetHeader(this.strm,g.header),g.dictionary){var y;if(y=typeof g.dictionary=="string"?o.string2buf(g.dictionary):_.call(g.dictionary)==="[object ArrayBuffer]"?new Uint8Array(g.dictionary):g.dictionary,(k=r.deflateSetDictionary(this.strm,y))!==w)throw new Error(u[k]);this._dict_set=!0}}function h(p,g){var k=new l(g);if(k.push(p,!0),k.err)throw k.msg||u[k.err];return k.result}l.prototype.push=function(p,g){var k,y,x=this.strm,z=this.options.chunkSize;if(this.ended)return!1;y=g===~~g?g:g===!0?4:0,typeof p=="string"?x.input=o.string2buf(p):_.call(p)==="[object ArrayBuffer]"?x.input=new Uint8Array(p):x.input=p,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new s.Buf8(z),x.next_out=0,x.avail_out=z),(k=r.deflate(x,y))!==1&&k!==w)return this.onEnd(k),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||y!==4&&y!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(s.shrinkBuf(x.output,x.next_out))):this.onData(s.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&k!==1);return y===4?(k=r.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===w):y!==2||(this.onEnd(w),!(x.avail_out=0))},l.prototype.onData=function(p){this.chunks.push(p)},l.prototype.onEnd=function(p){p===w&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},i.Deflate=l,i.deflate=h,i.deflateRaw=function(p,g){return(g=g||{}).raw=!0,h(p,g)},i.gzip=function(p,g){return(g=g||{}).gzip=!0,h(p,g)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,d,i){var r=e("./zlib/inflate"),s=e("./utils/common"),o=e("./utils/strings"),u=e("./zlib/constants"),v=e("./zlib/messages"),_=e("./zlib/zstream"),w=e("./zlib/gzheader"),C=Object.prototype.toString;function f(l){if(!(this instanceof f))return new f(l);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},l||{});var h=this.options;h.raw&&0<=h.windowBits&&h.windowBits<16&&(h.windowBits=-h.windowBits,h.windowBits===0&&(h.windowBits=-15)),!(0<=h.windowBits&&h.windowBits<16)||l&&l.windowBits||(h.windowBits+=32),15<h.windowBits&&h.windowBits<48&&!(15&h.windowBits)&&(h.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _,this.strm.avail_out=0;var p=r.inflateInit2(this.strm,h.windowBits);if(p!==u.Z_OK)throw new Error(v[p]);this.header=new w,r.inflateGetHeader(this.strm,this.header)}function m(l,h){var p=new f(h);if(p.push(l,!0),p.err)throw p.msg||v[p.err];return p.result}f.prototype.push=function(l,h){var p,g,k,y,x,z,I=this.strm,F=this.options.chunkSize,A=this.options.dictionary,B=!1;if(this.ended)return!1;g=h===~~h?h:h===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof l=="string"?I.input=o.binstring2buf(l):C.call(l)==="[object ArrayBuffer]"?I.input=new Uint8Array(l):I.input=l,I.next_in=0,I.avail_in=I.input.length;do{if(I.avail_out===0&&(I.output=new s.Buf8(F),I.next_out=0,I.avail_out=F),(p=r.inflate(I,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&A&&(z=typeof A=="string"?o.string2buf(A):C.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,p=r.inflateSetDictionary(this.strm,z)),p===u.Z_BUF_ERROR&&B===!0&&(p=u.Z_OK,B=!1),p!==u.Z_STREAM_END&&p!==u.Z_OK)return this.onEnd(p),!(this.ended=!0);I.next_out&&(I.avail_out!==0&&p!==u.Z_STREAM_END&&(I.avail_in!==0||g!==u.Z_FINISH&&g!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=o.utf8border(I.output,I.next_out),y=I.next_out-k,x=o.buf2string(I.output,k),I.next_out=y,I.avail_out=F-y,y&&s.arraySet(I.output,I.output,k,y,0),this.onData(x)):this.onData(s.shrinkBuf(I.output,I.next_out)))),I.avail_in===0&&I.avail_out===0&&(B=!0)}while((0<I.avail_in||I.avail_out===0)&&p!==u.Z_STREAM_END);return p===u.Z_STREAM_END&&(g=u.Z_FINISH),g===u.Z_FINISH?(p=r.inflateEnd(this.strm),this.onEnd(p),this.ended=!0,p===u.Z_OK):g!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),!(I.avail_out=0))},f.prototype.onData=function(l){this.chunks.push(l)},f.prototype.onEnd=function(l){l===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},i.Inflate=f,i.inflate=m,i.inflateRaw=function(l,h){return(h=h||{}).raw=!0,m(l,h)},i.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,d,i){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(u){for(var v=Array.prototype.slice.call(arguments,1);v.length;){var _=v.shift();if(_){if(typeof _!="object")throw new TypeError(_+"must be non-object");for(var w in _)_.hasOwnProperty(w)&&(u[w]=_[w])}}return u},i.shrinkBuf=function(u,v){return u.length===v?u:u.subarray?u.subarray(0,v):(u.length=v,u)};var s={arraySet:function(u,v,_,w,C){if(v.subarray&&u.subarray)u.set(v.subarray(_,_+w),C);else for(var f=0;f<w;f++)u[C+f]=v[_+f]},flattenChunks:function(u){var v,_,w,C,f,m;for(v=w=0,_=u.length;v<_;v++)w+=u[v].length;for(m=new Uint8Array(w),v=C=0,_=u.length;v<_;v++)f=u[v],m.set(f,C),C+=f.length;return m}},o={arraySet:function(u,v,_,w,C){for(var f=0;f<w;f++)u[C+f]=v[_+f]},flattenChunks:function(u){return[].concat.apply([],u)}};i.setTyped=function(u){u?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,s)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(r)},{}],42:[function(e,d,i){var r=e("./common"),s=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var u=new r.Buf8(256),v=0;v<256;v++)u[v]=252<=v?6:248<=v?5:240<=v?4:224<=v?3:192<=v?2:1;function _(w,C){if(C<65537&&(w.subarray&&o||!w.subarray&&s))return String.fromCharCode.apply(null,r.shrinkBuf(w,C));for(var f="",m=0;m<C;m++)f+=String.fromCharCode(w[m]);return f}u[254]=u[254]=1,i.string2buf=function(w){var C,f,m,l,h,p=w.length,g=0;for(l=0;l<p;l++)(64512&(f=w.charCodeAt(l)))==55296&&l+1<p&&(64512&(m=w.charCodeAt(l+1)))==56320&&(f=65536+(f-55296<<10)+(m-56320),l++),g+=f<128?1:f<2048?2:f<65536?3:4;for(C=new r.Buf8(g),l=h=0;h<g;l++)(64512&(f=w.charCodeAt(l)))==55296&&l+1<p&&(64512&(m=w.charCodeAt(l+1)))==56320&&(f=65536+(f-55296<<10)+(m-56320),l++),f<128?C[h++]=f:(f<2048?C[h++]=192|f>>>6:(f<65536?C[h++]=224|f>>>12:(C[h++]=240|f>>>18,C[h++]=128|f>>>12&63),C[h++]=128|f>>>6&63),C[h++]=128|63&f);return C},i.buf2binstring=function(w){return _(w,w.length)},i.binstring2buf=function(w){for(var C=new r.Buf8(w.length),f=0,m=C.length;f<m;f++)C[f]=w.charCodeAt(f);return C},i.buf2string=function(w,C){var f,m,l,h,p=C||w.length,g=new Array(2*p);for(f=m=0;f<p;)if((l=w[f++])<128)g[m++]=l;else if(4<(h=u[l]))g[m++]=65533,f+=h-1;else{for(l&=h===2?31:h===3?15:7;1<h&&f<p;)l=l<<6|63&w[f++],h--;1<h?g[m++]=65533:l<65536?g[m++]=l:(l-=65536,g[m++]=55296|l>>10&1023,g[m++]=56320|1023&l)}return _(g,m)},i.utf8border=function(w,C){var f;for((C=C||w.length)>w.length&&(C=w.length),f=C-1;0<=f&&(192&w[f])==128;)f--;return f<0||f===0?C:f+u[w[f]]>C?f:C}},{"./common":41}],43:[function(e,d,i){d.exports=function(r,s,o,u){for(var v=65535&r|0,_=r>>>16&65535|0,w=0;o!==0;){for(o-=w=2e3<o?2e3:o;_=_+(v=v+s[u++]|0)|0,--w;);v%=65521,_%=65521}return v|_<<16|0}},{}],44:[function(e,d,i){d.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,d,i){var r=function(){for(var s,o=[],u=0;u<256;u++){s=u;for(var v=0;v<8;v++)s=1&s?3988292384^s>>>1:s>>>1;o[u]=s}return o}();d.exports=function(s,o,u,v){var _=r,w=v+u;s^=-1;for(var C=v;C<w;C++)s=s>>>8^_[255&(s^o[C])];return-1^s}},{}],46:[function(e,d,i){var r,s=e("../utils/common"),o=e("./trees"),u=e("./adler32"),v=e("./crc32"),_=e("./messages"),w=0,C=4,f=0,m=-2,l=-1,h=4,p=2,g=8,k=9,y=286,x=30,z=19,I=2*y+1,F=15,A=3,B=258,K=B+A+1,E=42,T=113,c=1,D=2,Q=3,q=4;function re(n,L){return n.msg=_[L],L}function M(n){return(n<<1)-(4<n?9:0)}function te(n){for(var L=n.length;0<=--L;)n[L]=0}function R(n){var L=n.state,j=L.pending;j>n.avail_out&&(j=n.avail_out),j!==0&&(s.arraySet(n.output,L.pending_buf,L.pending_out,j,n.next_out),n.next_out+=j,L.pending_out+=j,n.total_out+=j,n.avail_out-=j,L.pending-=j,L.pending===0&&(L.pending_out=0))}function O(n,L){o._tr_flush_block(n,0<=n.block_start?n.block_start:-1,n.strstart-n.block_start,L),n.block_start=n.strstart,R(n.strm)}function J(n,L){n.pending_buf[n.pending++]=L}function V(n,L){n.pending_buf[n.pending++]=L>>>8&255,n.pending_buf[n.pending++]=255&L}function G(n,L){var j,S,b=n.max_chain_length,N=n.strstart,P=n.prev_length,U=n.nice_match,$=n.strstart>n.w_size-K?n.strstart-(n.w_size-K):0,Z=n.window,X=n.w_mask,H=n.prev,ee=n.strstart+B,ue=Z[N+P-1],se=Z[N+P];n.prev_length>=n.good_match&&(b>>=2),U>n.lookahead&&(U=n.lookahead);do if(Z[(j=L)+P]===se&&Z[j+P-1]===ue&&Z[j]===Z[N]&&Z[++j]===Z[N+1]){N+=2,j++;do;while(Z[++N]===Z[++j]&&Z[++N]===Z[++j]&&Z[++N]===Z[++j]&&Z[++N]===Z[++j]&&Z[++N]===Z[++j]&&Z[++N]===Z[++j]&&Z[++N]===Z[++j]&&Z[++N]===Z[++j]&&N<ee);if(S=B-(ee-N),N=ee-B,P<S){if(n.match_start=L,U<=(P=S))break;ue=Z[N+P-1],se=Z[N+P]}}while((L=H[L&X])>$&&--b!=0);return P<=n.lookahead?P:n.lookahead}function fe(n){var L,j,S,b,N,P,U,$,Z,X,H=n.w_size;do{if(b=n.window_size-n.lookahead-n.strstart,n.strstart>=H+(H-K)){for(s.arraySet(n.window,n.window,H,H,0),n.match_start-=H,n.strstart-=H,n.block_start-=H,L=j=n.hash_size;S=n.head[--L],n.head[L]=H<=S?S-H:0,--j;);for(L=j=H;S=n.prev[--L],n.prev[L]=H<=S?S-H:0,--j;);b+=H}if(n.strm.avail_in===0)break;if(P=n.strm,U=n.window,$=n.strstart+n.lookahead,Z=b,X=void 0,X=P.avail_in,Z<X&&(X=Z),j=X===0?0:(P.avail_in-=X,s.arraySet(U,P.input,P.next_in,X,$),P.state.wrap===1?P.adler=u(P.adler,U,X,$):P.state.wrap===2&&(P.adler=v(P.adler,U,X,$)),P.next_in+=X,P.total_in+=X,X),n.lookahead+=j,n.lookahead+n.insert>=A)for(N=n.strstart-n.insert,n.ins_h=n.window[N],n.ins_h=(n.ins_h<<n.hash_shift^n.window[N+1])&n.hash_mask;n.insert&&(n.ins_h=(n.ins_h<<n.hash_shift^n.window[N+A-1])&n.hash_mask,n.prev[N&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=N,N++,n.insert--,!(n.lookahead+n.insert<A)););}while(n.lookahead<K&&n.strm.avail_in!==0)}function we(n,L){for(var j,S;;){if(n.lookahead<K){if(fe(n),n.lookahead<K&&L===w)return c;if(n.lookahead===0)break}if(j=0,n.lookahead>=A&&(n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+A-1])&n.hash_mask,j=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),j!==0&&n.strstart-j<=n.w_size-K&&(n.match_length=G(n,j)),n.match_length>=A)if(S=o._tr_tally(n,n.strstart-n.match_start,n.match_length-A),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=A){for(n.match_length--;n.strstart++,n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+A-1])&n.hash_mask,j=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart,--n.match_length!=0;);n.strstart++}else n.strstart+=n.match_length,n.match_length=0,n.ins_h=n.window[n.strstart],n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+1])&n.hash_mask;else S=o._tr_tally(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++;if(S&&(O(n,!1),n.strm.avail_out===0))return c}return n.insert=n.strstart<A-1?n.strstart:A-1,L===C?(O(n,!0),n.strm.avail_out===0?Q:q):n.last_lit&&(O(n,!1),n.strm.avail_out===0)?c:D}function oe(n,L){for(var j,S,b;;){if(n.lookahead<K){if(fe(n),n.lookahead<K&&L===w)return c;if(n.lookahead===0)break}if(j=0,n.lookahead>=A&&(n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+A-1])&n.hash_mask,j=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),n.prev_length=n.match_length,n.prev_match=n.match_start,n.match_length=A-1,j!==0&&n.prev_length<n.max_lazy_match&&n.strstart-j<=n.w_size-K&&(n.match_length=G(n,j),n.match_length<=5&&(n.strategy===1||n.match_length===A&&4096<n.strstart-n.match_start)&&(n.match_length=A-1)),n.prev_length>=A&&n.match_length<=n.prev_length){for(b=n.strstart+n.lookahead-A,S=o._tr_tally(n,n.strstart-1-n.prev_match,n.prev_length-A),n.lookahead-=n.prev_length-1,n.prev_length-=2;++n.strstart<=b&&(n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+A-1])&n.hash_mask,j=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),--n.prev_length!=0;);if(n.match_available=0,n.match_length=A-1,n.strstart++,S&&(O(n,!1),n.strm.avail_out===0))return c}else if(n.match_available){if((S=o._tr_tally(n,0,n.window[n.strstart-1]))&&O(n,!1),n.strstart++,n.lookahead--,n.strm.avail_out===0)return c}else n.match_available=1,n.strstart++,n.lookahead--}return n.match_available&&(S=o._tr_tally(n,0,n.window[n.strstart-1]),n.match_available=0),n.insert=n.strstart<A-1?n.strstart:A-1,L===C?(O(n,!0),n.strm.avail_out===0?Q:q):n.last_lit&&(O(n,!1),n.strm.avail_out===0)?c:D}function ae(n,L,j,S,b){this.good_length=n,this.max_lazy=L,this.nice_length=j,this.max_chain=S,this.func=b}function ge(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*I),this.dyn_dtree=new s.Buf16(2*(2*x+1)),this.bl_tree=new s.Buf16(2*(2*z+1)),te(this.dyn_ltree),te(this.dyn_dtree),te(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(F+1),this.heap=new s.Buf16(2*y+1),te(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*y+1),te(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function de(n){var L;return n&&n.state?(n.total_in=n.total_out=0,n.data_type=p,(L=n.state).pending=0,L.pending_out=0,L.wrap<0&&(L.wrap=-L.wrap),L.status=L.wrap?E:T,n.adler=L.wrap===2?0:1,L.last_flush=w,o._tr_init(L),f):re(n,m)}function ke(n){var L=de(n);return L===f&&function(j){j.window_size=2*j.w_size,te(j.head),j.max_lazy_match=r[j.level].max_lazy,j.good_match=r[j.level].good_length,j.nice_match=r[j.level].nice_length,j.max_chain_length=r[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=A-1,j.match_available=0,j.ins_h=0}(n.state),L}function Ne(n,L,j,S,b,N){if(!n)return m;var P=1;if(L===l&&(L=6),S<0?(P=0,S=-S):15<S&&(P=2,S-=16),b<1||k<b||j!==g||S<8||15<S||L<0||9<L||N<0||h<N)return re(n,m);S===8&&(S=9);var U=new ge;return(n.state=U).strm=n,U.wrap=P,U.gzhead=null,U.w_bits=S,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=b+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+A-1)/A),U.window=new s.Buf8(2*U.w_size),U.head=new s.Buf16(U.hash_size),U.prev=new s.Buf16(U.w_size),U.lit_bufsize=1<<b+6,U.pending_buf_size=4*U.lit_bufsize,U.pending_buf=new s.Buf8(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=L,U.strategy=N,U.method=j,ke(n)}r=[new ae(0,0,0,0,function(n,L){var j=65535;for(j>n.pending_buf_size-5&&(j=n.pending_buf_size-5);;){if(n.lookahead<=1){if(fe(n),n.lookahead===0&&L===w)return c;if(n.lookahead===0)break}n.strstart+=n.lookahead,n.lookahead=0;var S=n.block_start+j;if((n.strstart===0||n.strstart>=S)&&(n.lookahead=n.strstart-S,n.strstart=S,O(n,!1),n.strm.avail_out===0)||n.strstart-n.block_start>=n.w_size-K&&(O(n,!1),n.strm.avail_out===0))return c}return n.insert=0,L===C?(O(n,!0),n.strm.avail_out===0?Q:q):(n.strstart>n.block_start&&(O(n,!1),n.strm.avail_out),c)}),new ae(4,4,8,4,we),new ae(4,5,16,8,we),new ae(4,6,32,32,we),new ae(4,4,16,16,oe),new ae(8,16,32,32,oe),new ae(8,16,128,128,oe),new ae(8,32,128,256,oe),new ae(32,128,258,1024,oe),new ae(32,258,258,4096,oe)],i.deflateInit=function(n,L){return Ne(n,L,g,15,8,0)},i.deflateInit2=Ne,i.deflateReset=ke,i.deflateResetKeep=de,i.deflateSetHeader=function(n,L){return n&&n.state?n.state.wrap!==2?m:(n.state.gzhead=L,f):m},i.deflate=function(n,L){var j,S,b,N;if(!n||!n.state||5<L||L<0)return n?re(n,m):m;if(S=n.state,!n.output||!n.input&&n.avail_in!==0||S.status===666&&L!==C)return re(n,n.avail_out===0?-5:m);if(S.strm=n,j=S.last_flush,S.last_flush=L,S.status===E)if(S.wrap===2)n.adler=0,J(S,31),J(S,139),J(S,8),S.gzhead?(J(S,(S.gzhead.text?1:0)+(S.gzhead.hcrc?2:0)+(S.gzhead.extra?4:0)+(S.gzhead.name?8:0)+(S.gzhead.comment?16:0)),J(S,255&S.gzhead.time),J(S,S.gzhead.time>>8&255),J(S,S.gzhead.time>>16&255),J(S,S.gzhead.time>>24&255),J(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),J(S,255&S.gzhead.os),S.gzhead.extra&&S.gzhead.extra.length&&(J(S,255&S.gzhead.extra.length),J(S,S.gzhead.extra.length>>8&255)),S.gzhead.hcrc&&(n.adler=v(n.adler,S.pending_buf,S.pending,0)),S.gzindex=0,S.status=69):(J(S,0),J(S,0),J(S,0),J(S,0),J(S,0),J(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),J(S,3),S.status=T);else{var P=g+(S.w_bits-8<<4)<<8;P|=(2<=S.strategy||S.level<2?0:S.level<6?1:S.level===6?2:3)<<6,S.strstart!==0&&(P|=32),P+=31-P%31,S.status=T,V(S,P),S.strstart!==0&&(V(S,n.adler>>>16),V(S,65535&n.adler)),n.adler=1}if(S.status===69)if(S.gzhead.extra){for(b=S.pending;S.gzindex<(65535&S.gzhead.extra.length)&&(S.pending!==S.pending_buf_size||(S.gzhead.hcrc&&S.pending>b&&(n.adler=v(n.adler,S.pending_buf,S.pending-b,b)),R(n),b=S.pending,S.pending!==S.pending_buf_size));)J(S,255&S.gzhead.extra[S.gzindex]),S.gzindex++;S.gzhead.hcrc&&S.pending>b&&(n.adler=v(n.adler,S.pending_buf,S.pending-b,b)),S.gzindex===S.gzhead.extra.length&&(S.gzindex=0,S.status=73)}else S.status=73;if(S.status===73)if(S.gzhead.name){b=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>b&&(n.adler=v(n.adler,S.pending_buf,S.pending-b,b)),R(n),b=S.pending,S.pending===S.pending_buf_size)){N=1;break}N=S.gzindex<S.gzhead.name.length?255&S.gzhead.name.charCodeAt(S.gzindex++):0,J(S,N)}while(N!==0);S.gzhead.hcrc&&S.pending>b&&(n.adler=v(n.adler,S.pending_buf,S.pending-b,b)),N===0&&(S.gzindex=0,S.status=91)}else S.status=91;if(S.status===91)if(S.gzhead.comment){b=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>b&&(n.adler=v(n.adler,S.pending_buf,S.pending-b,b)),R(n),b=S.pending,S.pending===S.pending_buf_size)){N=1;break}N=S.gzindex<S.gzhead.comment.length?255&S.gzhead.comment.charCodeAt(S.gzindex++):0,J(S,N)}while(N!==0);S.gzhead.hcrc&&S.pending>b&&(n.adler=v(n.adler,S.pending_buf,S.pending-b,b)),N===0&&(S.status=103)}else S.status=103;if(S.status===103&&(S.gzhead.hcrc?(S.pending+2>S.pending_buf_size&&R(n),S.pending+2<=S.pending_buf_size&&(J(S,255&n.adler),J(S,n.adler>>8&255),n.adler=0,S.status=T)):S.status=T),S.pending!==0){if(R(n),n.avail_out===0)return S.last_flush=-1,f}else if(n.avail_in===0&&M(L)<=M(j)&&L!==C)return re(n,-5);if(S.status===666&&n.avail_in!==0)return re(n,-5);if(n.avail_in!==0||S.lookahead!==0||L!==w&&S.status!==666){var U=S.strategy===2?function($,Z){for(var X;;){if($.lookahead===0&&(fe($),$.lookahead===0)){if(Z===w)return c;break}if($.match_length=0,X=o._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,X&&(O($,!1),$.strm.avail_out===0))return c}return $.insert=0,Z===C?(O($,!0),$.strm.avail_out===0?Q:q):$.last_lit&&(O($,!1),$.strm.avail_out===0)?c:D}(S,L):S.strategy===3?function($,Z){for(var X,H,ee,ue,se=$.window;;){if($.lookahead<=B){if(fe($),$.lookahead<=B&&Z===w)return c;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=A&&0<$.strstart&&(H=se[ee=$.strstart-1])===se[++ee]&&H===se[++ee]&&H===se[++ee]){ue=$.strstart+B;do;while(H===se[++ee]&&H===se[++ee]&&H===se[++ee]&&H===se[++ee]&&H===se[++ee]&&H===se[++ee]&&H===se[++ee]&&H===se[++ee]&&ee<ue);$.match_length=B-(ue-ee),$.match_length>$.lookahead&&($.match_length=$.lookahead)}if($.match_length>=A?(X=o._tr_tally($,1,$.match_length-A),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0):(X=o._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++),X&&(O($,!1),$.strm.avail_out===0))return c}return $.insert=0,Z===C?(O($,!0),$.strm.avail_out===0?Q:q):$.last_lit&&(O($,!1),$.strm.avail_out===0)?c:D}(S,L):r[S.level].func(S,L);if(U!==Q&&U!==q||(S.status=666),U===c||U===Q)return n.avail_out===0&&(S.last_flush=-1),f;if(U===D&&(L===1?o._tr_align(S):L!==5&&(o._tr_stored_block(S,0,0,!1),L===3&&(te(S.head),S.lookahead===0&&(S.strstart=0,S.block_start=0,S.insert=0))),R(n),n.avail_out===0))return S.last_flush=-1,f}return L!==C?f:S.wrap<=0?1:(S.wrap===2?(J(S,255&n.adler),J(S,n.adler>>8&255),J(S,n.adler>>16&255),J(S,n.adler>>24&255),J(S,255&n.total_in),J(S,n.total_in>>8&255),J(S,n.total_in>>16&255),J(S,n.total_in>>24&255)):(V(S,n.adler>>>16),V(S,65535&n.adler)),R(n),0<S.wrap&&(S.wrap=-S.wrap),S.pending!==0?f:1)},i.deflateEnd=function(n){var L;return n&&n.state?(L=n.state.status)!==E&&L!==69&&L!==73&&L!==91&&L!==103&&L!==T&&L!==666?re(n,m):(n.state=null,L===T?re(n,-3):f):m},i.deflateSetDictionary=function(n,L){var j,S,b,N,P,U,$,Z,X=L.length;if(!n||!n.state||(N=(j=n.state).wrap)===2||N===1&&j.status!==E||j.lookahead)return m;for(N===1&&(n.adler=u(n.adler,L,X,0)),j.wrap=0,X>=j.w_size&&(N===0&&(te(j.head),j.strstart=0,j.block_start=0,j.insert=0),Z=new s.Buf8(j.w_size),s.arraySet(Z,L,X-j.w_size,j.w_size,0),L=Z,X=j.w_size),P=n.avail_in,U=n.next_in,$=n.input,n.avail_in=X,n.next_in=0,n.input=L,fe(j);j.lookahead>=A;){for(S=j.strstart,b=j.lookahead-(A-1);j.ins_h=(j.ins_h<<j.hash_shift^j.window[S+A-1])&j.hash_mask,j.prev[S&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=S,S++,--b;);j.strstart=S,j.lookahead=A-1,fe(j)}return j.strstart+=j.lookahead,j.block_start=j.strstart,j.insert=j.lookahead,j.lookahead=0,j.match_length=j.prev_length=A-1,j.match_available=0,n.next_in=U,n.input=$,n.avail_in=P,j.wrap=N,f},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,d,i){d.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,d,i){d.exports=function(r,s){var o,u,v,_,w,C,f,m,l,h,p,g,k,y,x,z,I,F,A,B,K,E,T,c,D;o=r.state,u=r.next_in,c=r.input,v=u+(r.avail_in-5),_=r.next_out,D=r.output,w=_-(s-r.avail_out),C=_+(r.avail_out-257),f=o.dmax,m=o.wsize,l=o.whave,h=o.wnext,p=o.window,g=o.hold,k=o.bits,y=o.lencode,x=o.distcode,z=(1<<o.lenbits)-1,I=(1<<o.distbits)-1;e:do{k<15&&(g+=c[u++]<<k,k+=8,g+=c[u++]<<k,k+=8),F=y[g&z];t:for(;;){if(g>>>=A=F>>>24,k-=A,(A=F>>>16&255)===0)D[_++]=65535&F;else{if(!(16&A)){if(!(64&A)){F=y[(65535&F)+(g&(1<<A)-1)];continue t}if(32&A){o.mode=12;break e}r.msg="invalid literal/length code",o.mode=30;break e}B=65535&F,(A&=15)&&(k<A&&(g+=c[u++]<<k,k+=8),B+=g&(1<<A)-1,g>>>=A,k-=A),k<15&&(g+=c[u++]<<k,k+=8,g+=c[u++]<<k,k+=8),F=x[g&I];n:for(;;){if(g>>>=A=F>>>24,k-=A,!(16&(A=F>>>16&255))){if(!(64&A)){F=x[(65535&F)+(g&(1<<A)-1)];continue n}r.msg="invalid distance code",o.mode=30;break e}if(K=65535&F,k<(A&=15)&&(g+=c[u++]<<k,(k+=8)<A&&(g+=c[u++]<<k,k+=8)),f<(K+=g&(1<<A)-1)){r.msg="invalid distance too far back",o.mode=30;break e}if(g>>>=A,k-=A,(A=_-w)<K){if(l<(A=K-A)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break e}if(T=p,(E=0)===h){if(E+=m-A,A<B){for(B-=A;D[_++]=p[E++],--A;);E=_-K,T=D}}else if(h<A){if(E+=m+h-A,(A-=h)<B){for(B-=A;D[_++]=p[E++],--A;);if(E=0,h<B){for(B-=A=h;D[_++]=p[E++],--A;);E=_-K,T=D}}}else if(E+=h-A,A<B){for(B-=A;D[_++]=p[E++],--A;);E=_-K,T=D}for(;2<B;)D[_++]=T[E++],D[_++]=T[E++],D[_++]=T[E++],B-=3;B&&(D[_++]=T[E++],1<B&&(D[_++]=T[E++]))}else{for(E=_-K;D[_++]=D[E++],D[_++]=D[E++],D[_++]=D[E++],2<(B-=3););B&&(D[_++]=D[E++],1<B&&(D[_++]=D[E++]))}break}}break}}while(u<v&&_<C);u-=B=k>>3,g&=(1<<(k-=B<<3))-1,r.next_in=u,r.next_out=_,r.avail_in=u<v?v-u+5:5-(u-v),r.avail_out=_<C?C-_+257:257-(_-C),o.hold=g,o.bits=k}},{}],49:[function(e,d,i){var r=e("../utils/common"),s=e("./adler32"),o=e("./crc32"),u=e("./inffast"),v=e("./inftrees"),_=1,w=2,C=0,f=-2,m=1,l=852,h=592;function p(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(E){var T;return E&&E.state?(T=E.state,E.total_in=E.total_out=T.total=0,E.msg="",T.wrap&&(E.adler=1&T.wrap),T.mode=m,T.last=0,T.havedict=0,T.dmax=32768,T.head=null,T.hold=0,T.bits=0,T.lencode=T.lendyn=new r.Buf32(l),T.distcode=T.distdyn=new r.Buf32(h),T.sane=1,T.back=-1,C):f}function y(E){var T;return E&&E.state?((T=E.state).wsize=0,T.whave=0,T.wnext=0,k(E)):f}function x(E,T){var c,D;return E&&E.state?(D=E.state,T<0?(c=0,T=-T):(c=1+(T>>4),T<48&&(T&=15)),T&&(T<8||15<T)?f:(D.window!==null&&D.wbits!==T&&(D.window=null),D.wrap=c,D.wbits=T,y(E))):f}function z(E,T){var c,D;return E?(D=new g,(E.state=D).window=null,(c=x(E,T))!==C&&(E.state=null),c):f}var I,F,A=!0;function B(E){if(A){var T;for(I=new r.Buf32(512),F=new r.Buf32(32),T=0;T<144;)E.lens[T++]=8;for(;T<256;)E.lens[T++]=9;for(;T<280;)E.lens[T++]=7;for(;T<288;)E.lens[T++]=8;for(v(_,E.lens,0,288,I,0,E.work,{bits:9}),T=0;T<32;)E.lens[T++]=5;v(w,E.lens,0,32,F,0,E.work,{bits:5}),A=!1}E.lencode=I,E.lenbits=9,E.distcode=F,E.distbits=5}function K(E,T,c,D){var Q,q=E.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new r.Buf8(q.wsize)),D>=q.wsize?(r.arraySet(q.window,T,c-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(D<(Q=q.wsize-q.wnext)&&(Q=D),r.arraySet(q.window,T,c-D,Q,q.wnext),(D-=Q)?(r.arraySet(q.window,T,c-D,D,0),q.wnext=D,q.whave=q.wsize):(q.wnext+=Q,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=Q))),0}i.inflateReset=y,i.inflateReset2=x,i.inflateResetKeep=k,i.inflateInit=function(E){return z(E,15)},i.inflateInit2=z,i.inflate=function(E,T){var c,D,Q,q,re,M,te,R,O,J,V,G,fe,we,oe,ae,ge,de,ke,Ne,n,L,j,S,b=0,N=new r.Buf8(4),P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return f;(c=E.state).mode===12&&(c.mode=13),re=E.next_out,Q=E.output,te=E.avail_out,q=E.next_in,D=E.input,M=E.avail_in,R=c.hold,O=c.bits,J=M,V=te,L=C;e:for(;;)switch(c.mode){case m:if(c.wrap===0){c.mode=13;break}for(;O<16;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(2&c.wrap&&R===35615){N[c.check=0]=255&R,N[1]=R>>>8&255,c.check=o(c.check,N,2,0),O=R=0,c.mode=2;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&R)<<8)+(R>>8))%31){E.msg="incorrect header check",c.mode=30;break}if((15&R)!=8){E.msg="unknown compression method",c.mode=30;break}if(O-=4,n=8+(15&(R>>>=4)),c.wbits===0)c.wbits=n;else if(n>c.wbits){E.msg="invalid window size",c.mode=30;break}c.dmax=1<<n,E.adler=c.check=1,c.mode=512&R?10:12,O=R=0;break;case 2:for(;O<16;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(c.flags=R,(255&c.flags)!=8){E.msg="unknown compression method",c.mode=30;break}if(57344&c.flags){E.msg="unknown header flags set",c.mode=30;break}c.head&&(c.head.text=R>>8&1),512&c.flags&&(N[0]=255&R,N[1]=R>>>8&255,c.check=o(c.check,N,2,0)),O=R=0,c.mode=3;case 3:for(;O<32;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}c.head&&(c.head.time=R),512&c.flags&&(N[0]=255&R,N[1]=R>>>8&255,N[2]=R>>>16&255,N[3]=R>>>24&255,c.check=o(c.check,N,4,0)),O=R=0,c.mode=4;case 4:for(;O<16;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}c.head&&(c.head.xflags=255&R,c.head.os=R>>8),512&c.flags&&(N[0]=255&R,N[1]=R>>>8&255,c.check=o(c.check,N,2,0)),O=R=0,c.mode=5;case 5:if(1024&c.flags){for(;O<16;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}c.length=R,c.head&&(c.head.extra_len=R),512&c.flags&&(N[0]=255&R,N[1]=R>>>8&255,c.check=o(c.check,N,2,0)),O=R=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(1024&c.flags&&(M<(G=c.length)&&(G=M),G&&(c.head&&(n=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),r.arraySet(c.head.extra,D,q,G,n)),512&c.flags&&(c.check=o(c.check,D,G,q)),M-=G,q+=G,c.length-=G),c.length))break e;c.length=0,c.mode=7;case 7:if(2048&c.flags){if(M===0)break e;for(G=0;n=D[q+G++],c.head&&n&&c.length<65536&&(c.head.name+=String.fromCharCode(n)),n&&G<M;);if(512&c.flags&&(c.check=o(c.check,D,G,q)),M-=G,q+=G,n)break e}else c.head&&(c.head.name=null);c.length=0,c.mode=8;case 8:if(4096&c.flags){if(M===0)break e;for(G=0;n=D[q+G++],c.head&&n&&c.length<65536&&(c.head.comment+=String.fromCharCode(n)),n&&G<M;);if(512&c.flags&&(c.check=o(c.check,D,G,q)),M-=G,q+=G,n)break e}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(512&c.flags){for(;O<16;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(R!==(65535&c.check)){E.msg="header crc mismatch",c.mode=30;break}O=R=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),E.adler=c.check=0,c.mode=12;break;case 10:for(;O<32;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}E.adler=c.check=p(R),O=R=0,c.mode=11;case 11:if(c.havedict===0)return E.next_out=re,E.avail_out=te,E.next_in=q,E.avail_in=M,c.hold=R,c.bits=O,2;E.adler=c.check=1,c.mode=12;case 12:if(T===5||T===6)break e;case 13:if(c.last){R>>>=7&O,O-=7&O,c.mode=27;break}for(;O<3;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}switch(c.last=1&R,O-=1,3&(R>>>=1)){case 0:c.mode=14;break;case 1:if(B(c),c.mode=20,T!==6)break;R>>>=2,O-=2;break e;case 2:c.mode=17;break;case 3:E.msg="invalid block type",c.mode=30}R>>>=2,O-=2;break;case 14:for(R>>>=7&O,O-=7&O;O<32;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if((65535&R)!=(R>>>16^65535)){E.msg="invalid stored block lengths",c.mode=30;break}if(c.length=65535&R,O=R=0,c.mode=15,T===6)break e;case 15:c.mode=16;case 16:if(G=c.length){if(M<G&&(G=M),te<G&&(G=te),G===0)break e;r.arraySet(Q,D,q,G,re),M-=G,q+=G,te-=G,re+=G,c.length-=G;break}c.mode=12;break;case 17:for(;O<14;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(c.nlen=257+(31&R),R>>>=5,O-=5,c.ndist=1+(31&R),R>>>=5,O-=5,c.ncode=4+(15&R),R>>>=4,O-=4,286<c.nlen||30<c.ndist){E.msg="too many length or distance symbols",c.mode=30;break}c.have=0,c.mode=18;case 18:for(;c.have<c.ncode;){for(;O<3;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}c.lens[P[c.have++]]=7&R,R>>>=3,O-=3}for(;c.have<19;)c.lens[P[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,j={bits:c.lenbits},L=v(0,c.lens,0,19,c.lencode,0,c.work,j),c.lenbits=j.bits,L){E.msg="invalid code lengths set",c.mode=30;break}c.have=0,c.mode=19;case 19:for(;c.have<c.nlen+c.ndist;){for(;ae=(b=c.lencode[R&(1<<c.lenbits)-1])>>>16&255,ge=65535&b,!((oe=b>>>24)<=O);){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(ge<16)R>>>=oe,O-=oe,c.lens[c.have++]=ge;else{if(ge===16){for(S=oe+2;O<S;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(R>>>=oe,O-=oe,c.have===0){E.msg="invalid bit length repeat",c.mode=30;break}n=c.lens[c.have-1],G=3+(3&R),R>>>=2,O-=2}else if(ge===17){for(S=oe+3;O<S;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}O-=oe,n=0,G=3+(7&(R>>>=oe)),R>>>=3,O-=3}else{for(S=oe+7;O<S;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}O-=oe,n=0,G=11+(127&(R>>>=oe)),R>>>=7,O-=7}if(c.have+G>c.nlen+c.ndist){E.msg="invalid bit length repeat",c.mode=30;break}for(;G--;)c.lens[c.have++]=n}}if(c.mode===30)break;if(c.lens[256]===0){E.msg="invalid code -- missing end-of-block",c.mode=30;break}if(c.lenbits=9,j={bits:c.lenbits},L=v(_,c.lens,0,c.nlen,c.lencode,0,c.work,j),c.lenbits=j.bits,L){E.msg="invalid literal/lengths set",c.mode=30;break}if(c.distbits=6,c.distcode=c.distdyn,j={bits:c.distbits},L=v(w,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,j),c.distbits=j.bits,L){E.msg="invalid distances set",c.mode=30;break}if(c.mode=20,T===6)break e;case 20:c.mode=21;case 21:if(6<=M&&258<=te){E.next_out=re,E.avail_out=te,E.next_in=q,E.avail_in=M,c.hold=R,c.bits=O,u(E,V),re=E.next_out,Q=E.output,te=E.avail_out,q=E.next_in,D=E.input,M=E.avail_in,R=c.hold,O=c.bits,c.mode===12&&(c.back=-1);break}for(c.back=0;ae=(b=c.lencode[R&(1<<c.lenbits)-1])>>>16&255,ge=65535&b,!((oe=b>>>24)<=O);){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(ae&&!(240&ae)){for(de=oe,ke=ae,Ne=ge;ae=(b=c.lencode[Ne+((R&(1<<de+ke)-1)>>de)])>>>16&255,ge=65535&b,!(de+(oe=b>>>24)<=O);){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}R>>>=de,O-=de,c.back+=de}if(R>>>=oe,O-=oe,c.back+=oe,c.length=ge,ae===0){c.mode=26;break}if(32&ae){c.back=-1,c.mode=12;break}if(64&ae){E.msg="invalid literal/length code",c.mode=30;break}c.extra=15&ae,c.mode=22;case 22:if(c.extra){for(S=c.extra;O<S;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}c.length+=R&(1<<c.extra)-1,R>>>=c.extra,O-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=23;case 23:for(;ae=(b=c.distcode[R&(1<<c.distbits)-1])>>>16&255,ge=65535&b,!((oe=b>>>24)<=O);){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(!(240&ae)){for(de=oe,ke=ae,Ne=ge;ae=(b=c.distcode[Ne+((R&(1<<de+ke)-1)>>de)])>>>16&255,ge=65535&b,!(de+(oe=b>>>24)<=O);){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}R>>>=de,O-=de,c.back+=de}if(R>>>=oe,O-=oe,c.back+=oe,64&ae){E.msg="invalid distance code",c.mode=30;break}c.offset=ge,c.extra=15&ae,c.mode=24;case 24:if(c.extra){for(S=c.extra;O<S;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}c.offset+=R&(1<<c.extra)-1,R>>>=c.extra,O-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){E.msg="invalid distance too far back",c.mode=30;break}c.mode=25;case 25:if(te===0)break e;if(G=V-te,c.offset>G){if((G=c.offset-G)>c.whave&&c.sane){E.msg="invalid distance too far back",c.mode=30;break}fe=G>c.wnext?(G-=c.wnext,c.wsize-G):c.wnext-G,G>c.length&&(G=c.length),we=c.window}else we=Q,fe=re-c.offset,G=c.length;for(te<G&&(G=te),te-=G,c.length-=G;Q[re++]=we[fe++],--G;);c.length===0&&(c.mode=21);break;case 26:if(te===0)break e;Q[re++]=c.length,te--,c.mode=21;break;case 27:if(c.wrap){for(;O<32;){if(M===0)break e;M--,R|=D[q++]<<O,O+=8}if(V-=te,E.total_out+=V,c.total+=V,V&&(E.adler=c.check=c.flags?o(c.check,Q,V,re-V):s(c.check,Q,V,re-V)),V=te,(c.flags?R:p(R))!==c.check){E.msg="incorrect data check",c.mode=30;break}O=R=0}c.mode=28;case 28:if(c.wrap&&c.flags){for(;O<32;){if(M===0)break e;M--,R+=D[q++]<<O,O+=8}if(R!==(4294967295&c.total)){E.msg="incorrect length check",c.mode=30;break}O=R=0}c.mode=29;case 29:L=1;break e;case 30:L=-3;break e;case 31:return-4;case 32:default:return f}return E.next_out=re,E.avail_out=te,E.next_in=q,E.avail_in=M,c.hold=R,c.bits=O,(c.wsize||V!==E.avail_out&&c.mode<30&&(c.mode<27||T!==4))&&K(E,E.output,E.next_out,V-E.avail_out)?(c.mode=31,-4):(J-=E.avail_in,V-=E.avail_out,E.total_in+=J,E.total_out+=V,c.total+=V,c.wrap&&V&&(E.adler=c.check=c.flags?o(c.check,Q,V,E.next_out-V):s(c.check,Q,V,E.next_out-V)),E.data_type=c.bits+(c.last?64:0)+(c.mode===12?128:0)+(c.mode===20||c.mode===15?256:0),(J==0&&V===0||T===4)&&L===C&&(L=-5),L)},i.inflateEnd=function(E){if(!E||!E.state)return f;var T=E.state;return T.window&&(T.window=null),E.state=null,C},i.inflateGetHeader=function(E,T){var c;return E&&E.state&&2&(c=E.state).wrap?((c.head=T).done=!1,C):f},i.inflateSetDictionary=function(E,T){var c,D=T.length;return E&&E.state?(c=E.state).wrap!==0&&c.mode!==11?f:c.mode===11&&s(1,T,D,0)!==c.check?-3:K(E,T,D,D)?(c.mode=31,-4):(c.havedict=1,C):f},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,d,i){var r=e("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],u=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],v=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];d.exports=function(_,w,C,f,m,l,h,p){var g,k,y,x,z,I,F,A,B,K=p.bits,E=0,T=0,c=0,D=0,Q=0,q=0,re=0,M=0,te=0,R=0,O=null,J=0,V=new r.Buf16(16),G=new r.Buf16(16),fe=null,we=0;for(E=0;E<=15;E++)V[E]=0;for(T=0;T<f;T++)V[w[C+T]]++;for(Q=K,D=15;1<=D&&V[D]===0;D--);if(D<Q&&(Q=D),D===0)return m[l++]=20971520,m[l++]=20971520,p.bits=1,0;for(c=1;c<D&&V[c]===0;c++);for(Q<c&&(Q=c),E=M=1;E<=15;E++)if(M<<=1,(M-=V[E])<0)return-1;if(0<M&&(_===0||D!==1))return-1;for(G[1]=0,E=1;E<15;E++)G[E+1]=G[E]+V[E];for(T=0;T<f;T++)w[C+T]!==0&&(h[G[w[C+T]]++]=T);if(I=_===0?(O=fe=h,19):_===1?(O=s,J-=257,fe=o,we-=257,256):(O=u,fe=v,-1),E=c,z=l,re=T=R=0,y=-1,x=(te=1<<(q=Q))-1,_===1&&852<te||_===2&&592<te)return 1;for(;;){for(F=E-re,B=h[T]<I?(A=0,h[T]):h[T]>I?(A=fe[we+h[T]],O[J+h[T]]):(A=96,0),g=1<<E-re,c=k=1<<q;m[z+(R>>re)+(k-=g)]=F<<24|A<<16|B|0,k!==0;);for(g=1<<E-1;R&g;)g>>=1;if(g!==0?(R&=g-1,R+=g):R=0,T++,--V[E]==0){if(E===D)break;E=w[C+h[T]]}if(Q<E&&(R&x)!==y){for(re===0&&(re=Q),z+=c,M=1<<(q=E-re);q+re<D&&!((M-=V[q+re])<=0);)q++,M<<=1;if(te+=1<<q,_===1&&852<te||_===2&&592<te)return 1;m[y=R&x]=Q<<24|q<<16|z-l|0}}return R!==0&&(m[z+R]=E-re<<24|64<<16|0),p.bits=Q,0}},{"../utils/common":41}],51:[function(e,d,i){d.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,d,i){var r=e("../utils/common"),s=0,o=1;function u(b){for(var N=b.length;0<=--N;)b[N]=0}var v=0,_=29,w=256,C=w+1+_,f=30,m=19,l=2*C+1,h=15,p=16,g=7,k=256,y=16,x=17,z=18,I=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],F=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K=new Array(2*(C+2));u(K);var E=new Array(2*f);u(E);var T=new Array(512);u(T);var c=new Array(256);u(c);var D=new Array(_);u(D);var Q,q,re,M=new Array(f);function te(b,N,P,U,$){this.static_tree=b,this.extra_bits=N,this.extra_base=P,this.elems=U,this.max_length=$,this.has_stree=b&&b.length}function R(b,N){this.dyn_tree=b,this.max_code=0,this.stat_desc=N}function O(b){return b<256?T[b]:T[256+(b>>>7)]}function J(b,N){b.pending_buf[b.pending++]=255&N,b.pending_buf[b.pending++]=N>>>8&255}function V(b,N,P){b.bi_valid>p-P?(b.bi_buf|=N<<b.bi_valid&65535,J(b,b.bi_buf),b.bi_buf=N>>p-b.bi_valid,b.bi_valid+=P-p):(b.bi_buf|=N<<b.bi_valid&65535,b.bi_valid+=P)}function G(b,N,P){V(b,P[2*N],P[2*N+1])}function fe(b,N){for(var P=0;P|=1&b,b>>>=1,P<<=1,0<--N;);return P>>>1}function we(b,N,P){var U,$,Z=new Array(h+1),X=0;for(U=1;U<=h;U++)Z[U]=X=X+P[U-1]<<1;for($=0;$<=N;$++){var H=b[2*$+1];H!==0&&(b[2*$]=fe(Z[H]++,H))}}function oe(b){var N;for(N=0;N<C;N++)b.dyn_ltree[2*N]=0;for(N=0;N<f;N++)b.dyn_dtree[2*N]=0;for(N=0;N<m;N++)b.bl_tree[2*N]=0;b.dyn_ltree[2*k]=1,b.opt_len=b.static_len=0,b.last_lit=b.matches=0}function ae(b){8<b.bi_valid?J(b,b.bi_buf):0<b.bi_valid&&(b.pending_buf[b.pending++]=b.bi_buf),b.bi_buf=0,b.bi_valid=0}function ge(b,N,P,U){var $=2*N,Z=2*P;return b[$]<b[Z]||b[$]===b[Z]&&U[N]<=U[P]}function de(b,N,P){for(var U=b.heap[P],$=P<<1;$<=b.heap_len&&($<b.heap_len&&ge(N,b.heap[$+1],b.heap[$],b.depth)&&$++,!ge(N,U,b.heap[$],b.depth));)b.heap[P]=b.heap[$],P=$,$<<=1;b.heap[P]=U}function ke(b,N,P){var U,$,Z,X,H=0;if(b.last_lit!==0)for(;U=b.pending_buf[b.d_buf+2*H]<<8|b.pending_buf[b.d_buf+2*H+1],$=b.pending_buf[b.l_buf+H],H++,U===0?G(b,$,N):(G(b,(Z=c[$])+w+1,N),(X=I[Z])!==0&&V(b,$-=D[Z],X),G(b,Z=O(--U),P),(X=F[Z])!==0&&V(b,U-=M[Z],X)),H<b.last_lit;);G(b,k,N)}function Ne(b,N){var P,U,$,Z=N.dyn_tree,X=N.stat_desc.static_tree,H=N.stat_desc.has_stree,ee=N.stat_desc.elems,ue=-1;for(b.heap_len=0,b.heap_max=l,P=0;P<ee;P++)Z[2*P]!==0?(b.heap[++b.heap_len]=ue=P,b.depth[P]=0):Z[2*P+1]=0;for(;b.heap_len<2;)Z[2*($=b.heap[++b.heap_len]=ue<2?++ue:0)]=1,b.depth[$]=0,b.opt_len--,H&&(b.static_len-=X[2*$+1]);for(N.max_code=ue,P=b.heap_len>>1;1<=P;P--)de(b,Z,P);for($=ee;P=b.heap[1],b.heap[1]=b.heap[b.heap_len--],de(b,Z,1),U=b.heap[1],b.heap[--b.heap_max]=P,b.heap[--b.heap_max]=U,Z[2*$]=Z[2*P]+Z[2*U],b.depth[$]=(b.depth[P]>=b.depth[U]?b.depth[P]:b.depth[U])+1,Z[2*P+1]=Z[2*U+1]=$,b.heap[1]=$++,de(b,Z,1),2<=b.heap_len;);b.heap[--b.heap_max]=b.heap[1],function(se,Ee){var nt,Oe,rt,pe,gt,Rt,Te=Ee.dyn_tree,vn=Ee.max_code,Nr=Ee.stat_desc.static_tree,zr=Ee.stat_desc.has_stree,Rr=Ee.stat_desc.extra_bits,_n=Ee.stat_desc.extra_base,it=Ee.stat_desc.max_length,yt=0;for(pe=0;pe<=h;pe++)se.bl_count[pe]=0;for(Te[2*se.heap[se.heap_max]+1]=0,nt=se.heap_max+1;nt<l;nt++)it<(pe=Te[2*Te[2*(Oe=se.heap[nt])+1]+1]+1)&&(pe=it,yt++),Te[2*Oe+1]=pe,vn<Oe||(se.bl_count[pe]++,gt=0,_n<=Oe&&(gt=Rr[Oe-_n]),Rt=Te[2*Oe],se.opt_len+=Rt*(pe+gt),zr&&(se.static_len+=Rt*(Nr[2*Oe+1]+gt)));if(yt!==0){do{for(pe=it-1;se.bl_count[pe]===0;)pe--;se.bl_count[pe]--,se.bl_count[pe+1]+=2,se.bl_count[it]--,yt-=2}while(0<yt);for(pe=it;pe!==0;pe--)for(Oe=se.bl_count[pe];Oe!==0;)vn<(rt=se.heap[--nt])||(Te[2*rt+1]!==pe&&(se.opt_len+=(pe-Te[2*rt+1])*Te[2*rt],Te[2*rt+1]=pe),Oe--)}}(b,N),we(Z,ue,b.bl_count)}function n(b,N,P){var U,$,Z=-1,X=N[1],H=0,ee=7,ue=4;for(X===0&&(ee=138,ue=3),N[2*(P+1)+1]=65535,U=0;U<=P;U++)$=X,X=N[2*(U+1)+1],++H<ee&&$===X||(H<ue?b.bl_tree[2*$]+=H:$!==0?($!==Z&&b.bl_tree[2*$]++,b.bl_tree[2*y]++):H<=10?b.bl_tree[2*x]++:b.bl_tree[2*z]++,Z=$,ue=(H=0)===X?(ee=138,3):$===X?(ee=6,3):(ee=7,4))}function L(b,N,P){var U,$,Z=-1,X=N[1],H=0,ee=7,ue=4;for(X===0&&(ee=138,ue=3),U=0;U<=P;U++)if($=X,X=N[2*(U+1)+1],!(++H<ee&&$===X)){if(H<ue)for(;G(b,$,b.bl_tree),--H!=0;);else $!==0?($!==Z&&(G(b,$,b.bl_tree),H--),G(b,y,b.bl_tree),V(b,H-3,2)):H<=10?(G(b,x,b.bl_tree),V(b,H-3,3)):(G(b,z,b.bl_tree),V(b,H-11,7));Z=$,ue=(H=0)===X?(ee=138,3):$===X?(ee=6,3):(ee=7,4)}}u(M);var j=!1;function S(b,N,P,U){V(b,(v<<1)+(U?1:0),3),function($,Z,X,H){ae($),J($,X),J($,~X),r.arraySet($.pending_buf,$.window,Z,X,$.pending),$.pending+=X}(b,N,P)}i._tr_init=function(b){j||(function(){var N,P,U,$,Z,X=new Array(h+1);for($=U=0;$<_-1;$++)for(D[$]=U,N=0;N<1<<I[$];N++)c[U++]=$;for(c[U-1]=$,$=Z=0;$<16;$++)for(M[$]=Z,N=0;N<1<<F[$];N++)T[Z++]=$;for(Z>>=7;$<f;$++)for(M[$]=Z<<7,N=0;N<1<<F[$]-7;N++)T[256+Z++]=$;for(P=0;P<=h;P++)X[P]=0;for(N=0;N<=143;)K[2*N+1]=8,N++,X[8]++;for(;N<=255;)K[2*N+1]=9,N++,X[9]++;for(;N<=279;)K[2*N+1]=7,N++,X[7]++;for(;N<=287;)K[2*N+1]=8,N++,X[8]++;for(we(K,C+1,X),N=0;N<f;N++)E[2*N+1]=5,E[2*N]=fe(N,5);Q=new te(K,I,w+1,C,h),q=new te(E,F,0,f,h),re=new te(new Array(0),A,0,m,g)}(),j=!0),b.l_desc=new R(b.dyn_ltree,Q),b.d_desc=new R(b.dyn_dtree,q),b.bl_desc=new R(b.bl_tree,re),b.bi_buf=0,b.bi_valid=0,oe(b)},i._tr_stored_block=S,i._tr_flush_block=function(b,N,P,U){var $,Z,X=0;0<b.level?(b.strm.data_type===2&&(b.strm.data_type=function(H){var ee,ue=4093624447;for(ee=0;ee<=31;ee++,ue>>>=1)if(1&ue&&H.dyn_ltree[2*ee]!==0)return s;if(H.dyn_ltree[18]!==0||H.dyn_ltree[20]!==0||H.dyn_ltree[26]!==0)return o;for(ee=32;ee<w;ee++)if(H.dyn_ltree[2*ee]!==0)return o;return s}(b)),Ne(b,b.l_desc),Ne(b,b.d_desc),X=function(H){var ee;for(n(H,H.dyn_ltree,H.l_desc.max_code),n(H,H.dyn_dtree,H.d_desc.max_code),Ne(H,H.bl_desc),ee=m-1;3<=ee&&H.bl_tree[2*B[ee]+1]===0;ee--);return H.opt_len+=3*(ee+1)+5+5+4,ee}(b),$=b.opt_len+3+7>>>3,(Z=b.static_len+3+7>>>3)<=$&&($=Z)):$=Z=P+5,P+4<=$&&N!==-1?S(b,N,P,U):b.strategy===4||Z===$?(V(b,2+(U?1:0),3),ke(b,K,E)):(V(b,4+(U?1:0),3),function(H,ee,ue,se){var Ee;for(V(H,ee-257,5),V(H,ue-1,5),V(H,se-4,4),Ee=0;Ee<se;Ee++)V(H,H.bl_tree[2*B[Ee]+1],3);L(H,H.dyn_ltree,ee-1),L(H,H.dyn_dtree,ue-1)}(b,b.l_desc.max_code+1,b.d_desc.max_code+1,X+1),ke(b,b.dyn_ltree,b.dyn_dtree)),oe(b),U&&ae(b)},i._tr_tally=function(b,N,P){return b.pending_buf[b.d_buf+2*b.last_lit]=N>>>8&255,b.pending_buf[b.d_buf+2*b.last_lit+1]=255&N,b.pending_buf[b.l_buf+b.last_lit]=255&P,b.last_lit++,N===0?b.dyn_ltree[2*P]++:(b.matches++,N--,b.dyn_ltree[2*(c[P]+w+1)]++,b.dyn_dtree[2*O(N)]++),b.last_lit===b.lit_bufsize-1},i._tr_align=function(b){V(b,2,3),G(b,k,K),function(N){N.bi_valid===16?(J(N,N.bi_buf),N.bi_buf=0,N.bi_valid=0):8<=N.bi_valid&&(N.pending_buf[N.pending++]=255&N.bi_buf,N.bi_buf>>=8,N.bi_valid-=8)}(b)}},{"../utils/common":41}],53:[function(e,d,i){d.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,d,i){(function(r){(function(s,o){if(!s.setImmediate){var u,v,_,w,C=1,f={},m=!1,l=s.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(s);h=h&&h.setTimeout?h:s,u={}.toString.call(s.process)==="[object process]"?function(y){process.nextTick(function(){g(y)})}:function(){if(s.postMessage&&!s.importScripts){var y=!0,x=s.onmessage;return s.onmessage=function(){y=!1},s.postMessage("","*"),s.onmessage=x,y}}()?(w="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(y){s.postMessage(w+y,"*")}):s.MessageChannel?((_=new MessageChannel).port1.onmessage=function(y){g(y.data)},function(y){_.port2.postMessage(y)}):l&&"onreadystatechange"in l.createElement("script")?(v=l.documentElement,function(y){var x=l.createElement("script");x.onreadystatechange=function(){g(y),x.onreadystatechange=null,v.removeChild(x),x=null},v.appendChild(x)}):function(y){setTimeout(g,0,y)},h.setImmediate=function(y){typeof y!="function"&&(y=new Function(""+y));for(var x=new Array(arguments.length-1),z=0;z<x.length;z++)x[z]=arguments[z+1];var I={callback:y,args:x};return f[C]=I,u(C),C++},h.clearImmediate=p}function p(y){delete f[y]}function g(y){if(m)setTimeout(g,0,y);else{var x=f[y];if(x){m=!0;try{(function(z){var I=z.callback,F=z.args;switch(F.length){case 0:I();break;case 1:I(F[0]);break;case 2:I(F[0],F[1]);break;case 3:I(F[0],F[1],F[2]);break;default:I.apply(o,F)}})(x)}finally{p(y),m=!1}}}}function k(y){y.source===s&&typeof y.data=="string"&&y.data.indexOf(w)===0&&g(+y.data.slice(w.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof ut<"u"?ut:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Yt);var lr=Yt.exports;const cr=ar(lr),He=(t,a)=>{const e=t==null?void 0:t.getAttribute(a);return e==null||e===""?null:e};function Xt(t){const a=Number(He(t,"type")??0),e=He(t,"solution");return{type:a,typeName:_e(a),schemaName:He(t,"schemaName"),displayName:He(t,"displayName"),id:He(t,"id"),solution:e&&e.replace(/\s*\([\d.]+\)\s*$/,"").trim()||null,parentSchemaName:He(t,"parentSchemaName")}}const $e=t=>t.schemaName??t.displayName??t.id??"(unnamed)";function ur(t){const a=new DOMParser().parseFromString(t,"application/xml");if(a.getElementsByTagName("parsererror").length)throw new Error("solution.xml: invalid XML");const e=a.querySelector("ImportExportXml > SolutionManifest");if(!e)throw new Error("solution.xml: SolutionManifest not found");const d=r=>{var s,o;return((o=(s=e.querySelector(r))==null?void 0:s.textContent)==null?void 0:o.trim())??""},i=Array.from(e.querySelectorAll(":scope > MissingDependencies > MissingDependency")).map(r=>({required:Xt(r.querySelector(":scope > Required")),dependent:Xt(r.querySelector(":scope > Dependent"))}));return{uniqueName:d(":scope > UniqueName"),version:d(":scope > Version"),managed:d(":scope > Managed")!=="0"&&d(":scope > Managed")!=="",missing:i}}function dr(t,a,e){const d=new Map;for(const i of t){const r=i.required,s=Pe(a,null,$e(r))||!!r.solution&&Pe(a,{uniqueName:r.solution,prefix:""},$e(r)),o=!!r.solution&&!!(e!=null&&e.has(r.solution.toLowerCase()));if(!s&&!(e&&r.solution&&!o))continue;const u=i.dependent,v=`${u.type}:${(u.id??$e(u)).toLowerCase()}:${u.parentSchemaName??""}`,_=d.get(v)??{key:v,dependent:u,required:[],status:"safe"};_.required.some(w=>w.type===r.type&&$e(w)===$e(r))||_.required.push({...r,safe:o}),o||(_.status="blocker"),d.set(v,_)}return[...d.values()].sort((i,r)=>(i.status===r.status?0:i.status==="blocker"?-1:1)||i.dependent.type-r.dependent.type||$e(i.dependent).localeCompare($e(r.dependent)))}async function fr(t,a,e,d){let i;try{i=await cr.loadAsync(a)}catch{throw new Error(`${t}: not a zip file`)}const r=i.file(/^solution\.xml$/i)[0];if(!r)throw new Error(`${t}: solution.xml not found (is this a solution export?)`);const s=ur(await r.async("string"));return{fileName:t,uniqueName:s.uniqueName,version:s.version,managed:s.managed,total:s.missing.length,groups:dr(s.missing,e,d)}}const Jt=()=>window,je=()=>Jt().toolboxAPI,Qt=()=>Jt().dataverseAPI,en=()=>{var t;return!!((t=je())!=null&&t.connections)&&!!Qt()};async function tn(){var i,r;const t=je();if(!(t!=null&&t.connections))return[];const a=[],e=await t.connections.getActiveConnection().catch(()=>null);e&&a.push({target:"primary",conn:e});const d=await((r=(i=t.connections).getSecondaryConnection)==null?void 0:r.call(i).catch(()=>null));return d&&a.push({target:"secondary",conn:d}),a}function hr(t){var a,e;try{(e=(a=je())==null?void 0:a.events)==null||e.on((d,i)=>{typeof(i==null?void 0:i.event)=="string"&&i.event.startsWith("connection:")&&t()})}catch{}}async function pr(t){var d,i,r,s;const a=je();let e=(d=window.matchMedia)!=null&&d.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light";if((i=a==null?void 0:a.utils)!=null&&i.getCurrentTheme)try{e=await a.utils.getCurrentTheme()}catch{}t(e);try{(r=a==null?void 0:a.events)==null||r.on((o,u)=>{var v;if((u==null?void 0:u.event)==="settings:updated"){const _=(v=u.data)==null?void 0:v.theme;(_==="light"||_==="dark")&&t(_)}})}catch{}a||(s=window.matchMedia)==null||s.call(window,"(prefers-color-scheme: dark)").addEventListener("change",o=>t(o.matches?"dark":"light"))}async function be(t,a,e="info"){var i;const d=je();if((i=d==null?void 0:d.utils)!=null&&i.showNotification)try{await d.utils.showNotification({title:t,body:a,type:e,duration:4e3});return}catch{}console[e==="error"?"error":"log"](`${t}: ${a}`)}async function nn(t,a,e="application/json"){var s;const d=je();if((s=d==null?void 0:d.fileSystem)!=null&&s.saveFile)return!!await d.fileSystem.saveFile(t,a);const i=URL.createObjectURL(new Blob([a],{type:e})),r=document.createElement("a");return r.href=i,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3),!0}function mr(t){if(t instanceof Uint8Array)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);const a=t;if(a&&a.type==="Buffer"&&Array.isArray(a.data))return Uint8Array.from(a.data);if(Array.isArray(t))return Uint8Array.from(t);throw new Error("Unsupported binary payload from host")}function rn(t,a){return new Promise(e=>{const d=document.createElement("input");d.type="file",d.accept=t,d.multiple=a,d.addEventListener("change",()=>e(Array.from(d.files??[]))),d.addEventListener("cancel",()=>e([])),d.click()})}async function gr(t){var d;const a=je();if((d=a==null?void 0:a.fileSystem)!=null&&d.selectPath){const i=await a.fileSystem.selectPath({type:"file",title:t.title,filters:[{name:t.extensions.map(s=>s.toUpperCase()).join(" / "),extensions:t.extensions},{name:"All files",extensions:["*"]}]});if(!i)return[];const r=await a.fileSystem.readBinary(i);return[{name:i.split(/[\\/]/).pop()??i,data:mr(r)}]}const e=await rn(t.extensions.map(i=>`.${i}`).join(","),!!t.multiple);return Promise.all(e.map(async i=>({name:i.name,data:new Uint8Array(await i.arrayBuffer())})))}async function yr(t){var d;const a=je();if((d=a==null?void 0:a.fileSystem)!=null&&d.selectPath){const i=await a.fileSystem.selectPath({type:"file",title:t.title,filters:[{name:t.extensions.join("/"),extensions:t.extensions}]});return i?{name:i.split(/[\\/]/).pop()??i,text:await a.fileSystem.readText(i)}:null}const[e]=await rn(t.extensions.map(i=>`.${i}`).join(","),!1);return e?{name:e.name,text:await e.text()}:null}let Ve=[],Ue=[],De=null,Ct=new Lt;const on=new Map;let Ye,ie=null;const Re=new Map;let Se=null,Ce=[],Xe=!1,Je=null,Le=null,Et=0,At=!1,It=!1,ft=!1,ce=null;const Ge=()=>Qt(),ve=()=>Ve.find(t=>t.target==="primary"),sn=()=>Ve.find(t=>t.target==="secondary"),Qe=t=>!!t&&(t.conn.environment==="Production"||/\bprod/i.test(t.conn.name)),ht=()=>{var e;const t=((e=ve())==null?void 0:e.conn.url)??"";let a=on.get(t);return a||on.set(t,a=new Map),a},pt=(t,a)=>!!t&&!!a&&t.replace(/\/+$/,"").toLowerCase()===a.replace(/\/+$/,"").toLowerCase(),an=t=>t.map(a=>`${a.target}:${a.conn.id}:${a.conn.url}`).join("|"),ln=async()=>(await tn().catch(()=>[])).find(t=>t.target==="primary"),et=()=>{Se=null,Ce=[],Xe=!1,Je=null,Le=null},Nt=()=>{const t=er(Y("#filter").value);return t.length?t:Cn};function Ie(t){const a=Y("#status");a.hidden=!t,a.textContent=t??""}function cn(t,a){const e=W("span",{class:"dot"});return t.conn.environmentColor&&(e.style.background=t.conn.environmentColor),W("span",{class:"connchip",title:t.conn.url},e,W("span",{class:"env"},t.conn.name),W("span",{class:"kind"},`${a} · ${t.conn.environment}`))}function un(){const t=ve(),a=ie==null?void 0:ie.solution;return!t||!a?"https://make.powerapps.com/":Ye?`https://make.powerapps.com/environments/${Ye}/solutions/${a.id}`:`${t.conn.url.replace(/\/+$/,"")}/tools/solution/edit.aspx?id=${a.id}`}async function dn(){const t=an(Ve);Ve=await tn(),Ct=new Lt,Ye=void 0,an(Ve)!==t&&(Et++,ie=null,Re.clear(),et(),ce=null,Y("#fix-results").replaceChildren(),Y("#restore-results").replaceChildren(),Y("#restore-file").textContent="",Ke(),Me());const a=Y("#conn");a.replaceChildren();const e=ve(),d=sn();e&&a.append(cn(e,"dev")),d&&a.append(cn(d,"target")),e||a.append(W("span",{class:"caption"},en()?"No connection. Pick a primary (dev) connection in ToolBox.":"Standalone: Offline tab only."));const i=Ge();if(Ue=[],De=null,i&&e){Ie("Loading solutions…");try{Ue=await vt(i,"primary")}catch(u){await be("Load failed",u.message,"error")}if(d)try{De=new Set((await vt(i,"secondary")).map(u=>u.uniqueName.toLowerCase()))}catch(u){await be("Target load failed",`${d.conn.name}: ${u.message}`,"warning")}Ie(null)}const r=Y("#solution"),s=r.value,o=Ue.filter(u=>!u.isManaged&&!["default","active","basic"].includes(u.uniqueName.toLowerCase()));r.replaceChildren(...o.length?o.map(u=>W("option",{value:u.id},`${u.friendlyName} (${u.uniqueName}) ${u.version}`)):[W("option",{value:""},e?"No unmanaged solutions":"No connection")]),[...r.options].some(u=>u.value===s)&&(r.value=s),Y("#btn-run").disabled=!o.length}async function fn(t){const a=Ge(),e=ve(),d=Ue.find(s=>s.id===(t??Y("#solution").value));if(!a||!e||!d||It)return;It=!0,At=!1;const i=Et;Y("#btn-cancel").hidden=!1,Y("#btn-run").disabled=!0,Y("#progress").hidden=!1;const r=Y("#progress-bar");try{Ye===void 0&&(Ye=await Fn(a));const s=sn(),o=await ir({api:a,meta:Ct,reqCache:ht(),solution:d,allSolutions:Ue,targetSolutions:De,filter:Nt(),environment:{name:e.conn.name,url:e.conn.url,environment:e.conn.environment},target:s&&De?{name:s.conn.name,url:s.conn.url}:null,link:()=>un(),onProgress:(u,v)=>{r.max=Math.max(v,1),r.value=u,Y("#progress-text").textContent=`RetrieveRequiredComponents ${u} / ${v}`},cancelled:()=>At});if(i!==Et)return;ie=o;for(const u of ie.findings)for(const v of u.fixes)v.kind==="report"&&(v.link=un());for(const[u,v]of[...Re])ie.findings.some(_=>_.key===u&&_.fixes.some(w=>w.kind===v))||Re.delete(u)}catch(s){s instanceof Gt?await be("Cancelled","Diagnosis cancelled. Finished calls stay cached.","info"):await be("Diagnosis failed",s.message,"error")}finally{It=!1,Y("#btn-cancel").hidden=!0,Y("#btn-run").disabled=!1,Y("#progress").hidden=!0}mt()}function wr(t){var e;const a=!!t.solution&&!!(De!=null&&De.has(t.solution.uniqueName.toLowerCase()));return W("span",{class:`req${a?" is-safe":""}`,title:t.solutions.join(", ")},W("span",{class:"sol"},((e=t.solution)==null?void 0:e.uniqueName)??"unknown solution"),`${_e(t.type)} ${t.name}`,a?" · in target":"")}function br(t){const a=W("select",{class:"fix","aria-label":`Fix for ${t.dependent.name}`});a.append(W("option",{value:""},"No action"),...t.fixes.map(d=>W("option",{value:d.kind},d.label))),a.value=Re.get(t.key)??"",a.addEventListener("change",()=>{a.value?Re.set(t.key,a.value):Re.delete(t.key),hn()});const e=t.fixes.find(d=>d.kind==="report");return W("li",{class:`finding${t.status==="safe"?" is-safe":""}`,"data-key":t.key},W("div",{class:"head"},me(_e(t.dependent.type),"neutral"),W("span",{class:"name mono"},t.dependent.name),t.dependent.table||t.dependent.rootTable?W("span",{class:"caption"},t.dependent.table??t.dependent.rootTable??""):null,t.dependent.rootBehavior===0?me("table: all assets","warn"):null,me(t.status==="blocker"?"blocker":"present in target",t.status==="blocker"?"bad":"ok"),a),W("div",{class:"cause"},t.cause),W("div",{class:"chips"},...t.required.map(wr)),e!=null&&e.link?W("div",{class:"caption"},e.note??""," ",W("a",{href:e.link,target:"_blank",rel:"noopener"},"Open solution in maker portal")):null)}function hn(){Y("#sel-count").textContent=`${Re.size} selected`,Y("#btn-to-fix").disabled=Re.size===0}function mt(){const t=Y("#findings"),a=Y("#diag-summary");t.replaceChildren(),a.replaceChildren(),Y("#diag-actions").hidden=!ie;for(const o of["#btn-export-json","#btn-export-csv"])Y(o).toggleAttribute("disabled",!ie);if(!ie){t.append(Be("No diagnosis yet",ve()?"Pick an unmanaged solution and run Diagnose.":"Connect a dev environment in ToolBox, or use the Offline tab."));return}const e=ie,d=e.findings.filter(o=>o.status==="blocker"),i=e.findings.length-d.length,r=Y("#show-safe").checked;a.append(W("div",{class:"summary"},W("strong",{},`${e.solution.friendlyName}`),`${e.components.length} components ·`,me(`${d.length} blocker${d.length===1?"":"s"}`,d.length?"bad":"ok"),e.target?me(`${i} present in target`,"ok"):W("span",{class:"caption"},"No target connection: every dependency matching the filter counts."),e.errors.length?me(`${e.errors.length} lookups failed`,"warn"):null));for(const o of e.warnings??[])a.append(W("div",{class:"warnings"},o));e.errors.length&&a.append(W("div",{class:"warnings"},`RetrieveRequiredComponents failed for ${e.errors.length} component(s): ${e.errors.slice(0,3).map(o=>`${o.component} (${o.error})`).join("; ")}`));const s=e.findings.filter(o=>r||o.status==="blocker");s.length?t.append(W("ul",{class:"findings"},...s.map(br))):t.append(Be("No blocking dependencies",e.findings.length?"Everything found is present in the target. Tick “Show present in target” to see it.":"Nothing in this solution depends on the filtered solutions.")),hn()}function zt(t,a,e){const d=W("pre",{class:"diff","aria-label":e});for(const i of Vn(t,a))d.append(W("span",{class:i.t==="-"?"del":i.t==="+"?"add":i.t==="…"?"gap":"ctx"},i.t==="…"?"…":`${i.t} ${i.s}`));return d}function pn(t){const a=W("li",{class:"op","data-kind":t.kind},W("span",{class:"mono"},St(t)));if((t.kind==="remove"||t.kind==="add")&&a.append(" ",W("span",{class:"why"},t.reason)),t.kind==="update-form"){const e=t.edit;ze(a,e.removed.length?W("div",{class:"caption"},`Removes: ${e.removed.join(", ")}`):null,e.kept.length?W("div",{class:"caption"},`Kept: ${e.kept.map(d=>`${d.name} (${d.reason})`).join(", ")}`):null,e.warnings.length?W("div",{class:"warnings"},e.warnings.join(" ")):null,zt(e.form.formxml,e.after,`formxml diff ${e.form.name}`))}if(t.kind==="update-view"){const e=t.edit;ze(a,e.removed.length?W("div",{class:"caption"},`Removes: ${e.removed.join(", ")}`):null,e.warnings.length?W("div",{class:"warnings"},e.warnings.join(" ")):null,zt(e.view.fetchxml,e.after.fetchxml,`fetchxml diff ${e.view.name}`),zt(e.view.layoutxml,e.after.layoutxml,`layoutxml diff ${e.view.name}`))}return a}function mn(){return!!(ie!=null&&ie.solution.isManaged)}function tt(){const t=!Qe(ve())||Y("#prod-ack").checked;Y("#btn-confirm").disabled=ft||!(Xe&&Ce.length&&Le&&t&&!mn()),Y("#btn-backup").textContent=Xe?"1. Backup saved ✓":"1. Download backup"}function Ke(){const t=Y("#fix-banners"),a=Y("#fix-body");if(t.replaceChildren(),a.replaceChildren(),Y("#fix-actions").hidden=!Se,tt(),Je){t.append(W("div",{class:"danger-banner",id:"preview-error"},Je)),a.append(Be("Preview refused","Change the selected fixes in Diagnose, then Preview fixes again."));return}if(!Se||!ie){a.append(Be("Nothing selected","Pick a fix on one or more findings in Diagnose, then Preview fixes."));return}mn()&&t.append(W("div",{class:"danger-banner"},`${ie.solution.uniqueName} is managed. Writes are refused: fix dependencies in the dev environment, in the unmanaged solution.`)),Qe(ve())&&t.append(W("div",{class:"danger-banner"},`This connection (${ve().conn.name}) looks like Production. Dependencies are fixed in dev.`)),Y("#prod-ack-wrap").hidden=!Qe(ve());for(const e of Se.shells){const d=e.leaving.map(i=>{const r=W("input",{type:"checkbox","aria-label":`Keep ${i.component.name}`});return r.checked=i.keep,r.addEventListener("change",()=>{i.keep=r.checked,Ce=Ut(Se),gn()}),W("label",{title:i.why},r,me(_e(i.component.type),"neutral"),W("span",{class:"mono"},i.component.name??i.component.objectId),W("span",{class:"caption"},i.why))});a.append(W("div",{class:"card"},W("div",{class:"card-head"},W("h3",{},`Shell conversion: ${e.root.name}`),me(`${e.leaving.filter(i=>!i.keep).length} leave`,"warn")),W("div",{class:"card-body"},W("p",{class:"caption"},"The table is removed and added back without subcomponents. Every subcomponent below leaves the solution unless ticked to re-add. Other developers may rely on them."),e.leaving.length?W("div",{class:"leaving"},...d):W("p",{class:"caption"},"No subcomponent rows."))))}Se.skipped.length&&a.append(W("div",{class:"warnings"},"Not changed: ",Se.skipped.map(e=>`${e.name} (${e.reason})`).join("; "))),a.append(W("div",{id:"ops-wrap"})),gn()}function gn(){const t=document.getElementById("ops-wrap");t&&(t.replaceChildren(W("h3",{},`${Ce.length} operation${Ce.length===1?"":"s"} on ${(ie==null?void 0:ie.solution.uniqueName)??""}`),Ce.length?W("ol",{class:"ops",id:"ops"},...Ce.map(pn)):Be("No operations","The selected fixes change nothing.")),tt())}async function vr(){const t=Ge(),a=ve();if(!t||!a||!ie)return;const e=[...Re].map(([d,i])=>({finding:ie.findings.find(r=>r.key===d),fix:i})).filter(d=>d.finding&&d.finding.fixes.some(i=>i.kind===d.fix));Ie("Preparing preview…"),et(),Y("#prod-ack").checked=!1,Y("#fix-results").replaceChildren();try{if(!pt(a.conn.url,ie.environment.url))throw new Error(`The diagnosis was run on ${ie.environment.url}, the connection is now ${a.conn.url}. Run Diagnose again.`);Se=await Zn(t,Ct,ie,e),Ce=Ut(Se),Le={id:a.conn.id,url:a.conn.url}}catch(d){et(),Je=d.message,await be("Preview failed",Je,"error")}finally{Ie(null)}document.querySelector('.tab[data-tab="fix"]').click(),Ke()}async function _r(){if(!ie||!Se)return;const t=Yn(ie,Se,Ce);await nn(Xn(ie.solution.uniqueName),JSON.stringify(t,null,2))&&(Xe=!0,await be("Backup saved","Keep it: the Restore tab reapplies it.","success")),tt()}function yn(t){return W("table",{},W("thead",{},W("tr",{},W("th",{},"Operation"),W("th",{},"Result"))),W("tbody",{},...t.map(a=>W("tr",{},W("td",{class:"mono"},St(a.op)),W("td",{},a.ok?me("ok","ok"):a.skipped?me(a.error??"skipped","neutral"):me(a.error??"failed","bad"))))))}async function kr(){const t=Ge();if(!(ft||!t||!ie||!Se||!Xe||!Ce.length||!Le)){ft=!0,Y("#btn-confirm").disabled=!0;try{await xr(t)}finally{ft=!1,tt()}}}async function xr(t){if(!ie||!Le)return;const a=ie.solution,e=await ln();if(!e||e.conn.id!==Le.id||!pt(e.conn.url,Le.url)){const w=Le.url;et(),Ke(),await be("Refused",`The plan was made on ${w}, the connection is now ${(e==null?void 0:e.conn.url)??"none"}. Nothing was written: run Diagnose and Preview again.`,"error");return}const d=await Bt(t,a.id).catch(()=>null);if(!d||d.isManaged||a.isManaged){ie={...ie,solution:{...ie.solution,isManaged:!0}},Ke(),await be("Refused",`${a.uniqueName} is managed (or could not be read). Nothing was written.`,"error");return}Y("#btn-confirm").disabled=!0;const i=ie.findings.filter(w=>w.status==="blocker").map(w=>w.key),r=new Set;for(const w of Ce)w.kind==="update-form"&&r.add(Ae(ne.Form,w.edit.form.id)),w.kind==="update-view"&&r.add(Ae(ne.View,w.edit.view.id)),(w.kind==="remove"||w.kind==="add")&&r.add(Ae(w.component.type,w.component.id));const s=await Mt(t,Ce,d.uniqueName,(w,C)=>Ie(w<C?`Applying ${w+1} / ${C}…`:null));Ie(null);const o=s.filter(w=>!w.ok&&!w.skipped).length;await be(o?"Some operations failed":"Applied",o?"Restore from the backup if needed.":`${s.length} operations done. Re-running diagnosis…`,o?"error":"success");for(const w of r)ht().delete(w);et(),Re.clear(),Ke();const u=Y("#fix-results");u.replaceChildren(W("h3",{},"Results"),yn(s)),await fn(a.id);const v=new Set(((ie==null?void 0:ie.findings)??[]).filter(w=>w.status==="blocker").map(w=>w.key)),_=i.filter(w=>!v.has(w)).length;u.append(W("div",{class:"summary",id:"rediag"},W("strong",{},"Re-diagnosis:"),me(`${_} fixed`,"ok"),me(`${i.length-_} still present`,i.length-_?"bad":"ok"),me(`${v.size} blockers now`,v.size?"bad":"ok")))}async function Sr(){const t=await yr({title:"Open Dependency Cleaner backup",extensions:["json"]});if(!t)return;Y("#restore-results").replaceChildren();try{ce={backup:Jn(t.text),plan:null,url:null},Y("#restore-file").textContent=t.name}catch(d){ce=null,await be("Backup rejected",`${t.name}: ${d.message}`,"error"),Me();return}const a=Ge(),e=ve();if(a&&e){Ie("Comparing backup to the environment…"),ce.url=e.conn.url;try{ce.plan=await Qn(a,ce.backup,Ue.length?Ue:await vt(a,"primary"),e.conn.url)}catch(d){await be("Restore refused",d.message,"error"),Me(d.message),Ie(null);return}Ie(null)}Me()}function Me(t){var d;const a=Y("#restore-body");if(a.replaceChildren(),Y("#restore-actions").hidden=!(ce!=null&&ce.plan),Y("#btn-restore-apply").disabled=!((d=ce==null?void 0:ce.plan)!=null&&d.ops.length),!ce){a.append(Be("No backup loaded","Load a dependency-cleaner-backup-*.json file saved before a fix."));return}const e=ce.backup;if(a.append(W("p",{class:"caption"},`Backup of ${e.solution.uniqueName} from ${e.environment.name}, ${e.takenAt}. ${e.membership.length} members, ${e.forms.length} forms, ${e.views.length} views.`)),t&&a.append(W("div",{class:"danger-banner",id:"restore-error"},t)),!!ce.plan){for(const i of ce.plan.notes)a.append(W("div",{class:"warnings"},i));Qe(ve())&&a.append(W("div",{class:"danger-banner"},`This connection (${ve().conn.name}) looks like Production.`)),a.append(ce.plan.ops.length?W("ol",{class:"ops",id:"restore-ops"},...ce.plan.ops.map(pn)):Be("Nothing to restore","The environment already matches the backup."))}}async function Cr(){var o,u,v;const t=Ge();if(!t||!(ce!=null&&ce.plan))return;const a=ce.plan,e=await ln();if(!e||!pt(e.conn.url,ce.url)||!pt(e.conn.url,(o=ce.backup.environment)==null?void 0:o.url)){ce.plan=null,Me(),await be("Refused",`The backup is from ${((u=ce.backup.environment)==null?void 0:u.url)??"an unknown environment"}, the connection is now ${(e==null?void 0:e.conn.url)??"none"}. Nothing was written: load the backup again on the right connection.`,"error");return}const d=await Bt(t,a.solution.id).catch(()=>null);if(!d||d.isManaged){await be("Refused",`${a.solution.uniqueName} is managed (or could not be read). Nothing was written.`,"error");return}if(!await kn({title:"Apply restore",body:W("p",{},`${a.ops.length} operations on ${a.solution.uniqueName} in ${((v=ve())==null?void 0:v.conn.name)??""}.`),okLabel:`Apply ${a.ops.length}`,danger:Qe(ve())}))return;const r=await Mt(t,a.ops,d.uniqueName,(_,w)=>Ie(_<w?`Restoring ${_+1} / ${w}…`:null));Ie(null);for(const _ of a.ops)_.kind==="update-form"&&ht().delete(Ae(ne.Form,_.edit.form.id)),_.kind==="update-view"&&ht().delete(Ae(ne.View,_.edit.view.id));const s=r.filter(_=>!_.ok&&!_.skipped).length;await be(s?"Restore incomplete":"Restored",`${r.length-s} ok, ${s} failed`,s?"error":"success"),ce.plan=null,Me(),Y("#restore-results").replaceChildren(W("h3",{},"Restore results"),yn(r))}async function wn(t,a){const e=Y("#offline-body");try{Er(await fr(t,a,Nt(),De))}catch(d){e.replaceChildren(W("div",{class:"danger-banner"},d.message))}}function Er(t){const a=t.groups.filter(i=>i.status==="blocker").length,e=i=>`${i.typeName} ${$e(i)}${i.parentSchemaName?` (${i.parentSchemaName})`:""}`,d=t.groups.map(i=>W("li",{class:`finding${i.status==="safe"?" is-safe":""}`},W("div",{class:"head"},me(i.dependent.typeName,"neutral"),W("span",{class:"name mono"},$e(i.dependent)),i.dependent.parentSchemaName?W("span",{class:"caption"},i.dependent.parentSchemaName):null,me(i.status==="blocker"?"blocker":"present in target",i.status==="blocker"?"bad":"ok")),W("div",{class:"chips"},...i.required.map(r=>W("span",{class:`req${r.safe?" is-safe":""}`},W("span",{class:"sol"},r.solution??"unknown solution"),e(r))))));Y("#offline-body").replaceChildren(W("div",{class:"summary",id:"offline-summary"},W("strong",{},`${t.uniqueName} ${t.version}`),t.managed?me("managed","neutral"):me("unmanaged","neutral"),`${t.total} missing dependencies in solution.xml ·`,me(`${t.groups.length} dependents in scope`,"neutral"),me(`${a} blocking`,a?"bad":"ok")),t.groups.length?W("ul",{class:"findings"},...d):Be("No missing dependencies in scope",`Filter: ${Nt().join(", ")}`))}function Ar(){const t=Y("#drop");t.addEventListener("dragover",a=>{a.preventDefault(),t.classList.add("is-over")}),t.addEventListener("dragleave",()=>t.classList.remove("is-over")),t.addEventListener("drop",async a=>{var d,i;a.preventDefault(),t.classList.remove("is-over");const e=(i=(d=a.dataTransfer)==null?void 0:d.files)==null?void 0:i[0];e&&await wn(e.name,new Uint8Array(await e.arrayBuffer()))}),Y("#btn-open-zip").addEventListener("click",async()=>{const[a]=await gr({title:"Open solution zip",extensions:["zip"]});a&&await wn(a.name,a.data)})}async function bn(t,a,e){await nn(t,a,e)&&await be("Exported",t,"success")}function Ir(){xn(),Y("#btn-run").addEventListener("click",()=>void fn()),Y("#btn-cancel").addEventListener("click",()=>{At=!0}),Y("#show-safe").addEventListener("change",mt),Y("#btn-to-fix").addEventListener("click",()=>void vr()),Y("#btn-backup").addEventListener("click",()=>void _r()),Y("#prod-ack").addEventListener("change",tt),Y("#btn-confirm").addEventListener("click",()=>void kr()),Y("#btn-load-backup").addEventListener("click",()=>void Sr()),Y("#btn-restore-apply").addEventListener("click",()=>void Cr()),Y("#btn-export-json").addEventListener("click",()=>{ie&&bn(`dependency-findings.${Vt(ie.solution.uniqueName)}.json`,sr(ie),"application/json")}),Y("#btn-export-csv").addEventListener("click",()=>{ie&&bn(`dependency-findings.${Vt(ie.solution.uniqueName)}.csv`,or(ie),"text/csv")}),Ar(),hr(()=>void dn().then(mt)),Y("#host-mode").textContent=en()?"Running inside Power Platform ToolBox":"Standalone mode (Offline tab only)"}pr(t=>document.documentElement.setAttribute("data-theme",t)),Ir(),mt(),Ke(),Me(),dn()})();
|
package/dist/index.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplesmoothsafe/pptb-dependency-cleaner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"displayName": "SSS Dependency Cleaner",
|
|
5
5
|
"description": "Why does my solution depend on msdyn_*? Find every dependency of an unmanaged solution on a managed solution the target environment lacks, see the component that causes it, and fix it in place: convert tables to shells, remove components, strip msdyn columns from forms and views. Preview, backup and restore.",
|
|
6
6
|
"main": "index.html",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var hr=Object.defineProperty;var pr=(K,It,M)=>It in K?hr(K,It,{enumerable:!0,configurable:!0,writable:!0,value:M}):K[It]=M;var de=(K,It,M)=>pr(K,typeof It!="symbol"?It+"":It,M);(function(){"use strict";const K=e=>{const c=document.querySelector(e);if(!c)throw new Error(`missing ${e}`);return c};function It(e,...c){for(const t of c)t!=null&&t!==!1&&e.append(t)}function M(e,c={},...t){const u=document.createElement(e);for(const[i,r]of Object.entries(c))r===void 0||r===!1||(i==="class"?u.className=String(r):r===!0?u.setAttribute(i,""):u.setAttribute(i,r));for(const i of t)i!=null&&i!==!1&&u.append(typeof i=="string"?document.createTextNode(i):i);return u}const pt=(e,c="")=>M("span",{class:`badge${c?` badge-${c}`:""}`},e),Lt=(e,c)=>M("div",{class:"empty-state"},M("strong",{},e),c);function dn(e){const c=K("#dlg");K("#dlg-title").textContent=e.title;const t=K("#dlg-target");t.replaceChildren(),e.target&&t.append(e.target),K("#dlg-body").replaceChildren(e.body);const u=K("#dlg-ok");return u.textContent=e.okLabel??"",u.className=`btn ${e.danger?"btn-danger":"btn-primary"}`,u.style.flex="none",u.hidden=!e.okLabel,new Promise(i=>{let r=!1;const s=o=>{r||(r=!0,u.onclick=null,K("#dlg-cancel").onclick=null,c.onclose=null,c.open?(c.addEventListener("close",()=>i(o),{once:!0}),c.close()):i(o))};u.onclick=()=>s(!0),K("#dlg-cancel").onclick=()=>s(!1),c.onclose=()=>s(!1),c.showModal()})}function fn(e){document.querySelectorAll(".tab").forEach(c=>c.addEventListener("click",()=>{const t=c.dataset.tab;document.querySelectorAll(".tab").forEach(u=>u.classList.toggle("is-active",u===c)),document.querySelectorAll(".panel[id^='tab-']").forEach(u=>u.hidden=u.id!==`tab-${t}`)}))}const it={Entity:1,Attribute:2,Relationship:3,OptionSet:9,EntityRelationship:10,View:26,Workflow:29,Chart:59,Form:60,WebResource:61,SiteMap:62,AppModule:80,PluginStep:92},hn={1:"Table",2:"Column",3:"Relationship",9:"Choice",10:"Relationship",14:"Key",20:"Security role",24:"Form",26:"View",29:"Process",31:"Report",36:"Email template",48:"Ribbon command",50:"Ribbon",55:"Ribbon diff",59:"Chart",60:"Form",61:"Web resource",62:"Site map",63:"Connection role",65:"Hierarchy rule",66:"Custom control",70:"Field security profile",80:"Model-driven app",90:"Plugin type",91:"Plugin assembly",92:"Plugin step",300:"Canvas app",371:"Connector",372:"Connection reference",380:"Environment variable"},vt=e=>hn[e]??`Type ${e}`,pn=["msdyn","msdynce","mspp"],Qt=e=>e==null||e===""?null:String(e),gt=e=>String(e??"").toLowerCase(),Ee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function te(e,c="id"){if(!Ee.test(e))throw new Error(`${c} is not a guid: ${e}`);return e.toLowerCase()}function mn(e){const c=e.match(/\/api\/data\/v\d+(?:\.\d+)*\/(.*)$/i);return c?c[1]:e}const Ae=500;async function fe(e,c,t="primary"){const u=[],i=new Set;let r=c;for(let s=0;r&&s<Ae;s++){const o=await e.queryData(r,t);u.push(...o.value??[]);const p=o["@odata.nextLink"];if(r=typeof p=="string"&&p?mn(p):null,r&&i.has(r))throw new Error(`paging loop at ${r}`);r&&i.add(r)}if(r)throw new Error(`more than ${Ae} pages for ${c.split("?")[0]}`);return u}const Ie=40;async function ee(e,c,t,u,i="primary"){const r=[...new Set(c.map(p=>p.toLowerCase()))].filter(p=>Ee.test(p)),s=[];for(let p=0;p<r.length;p+=Ie)s.push(r.slice(p,p+Ie));return(await Promise.all(s.map(p=>fe(e,u(p.map(w=>`${t} eq ${w}`).join(" or ")),i)))).flat()}async function gn(e,c,t,u=()=>!1){let i=0;const r=async()=>{for(;i<e.length&&!u();){const s=e[i++];await t(s)}};await Promise.all(Array.from({length:Math.min(c,e.length)},r))}async function he(e,c="primary"){const[t,u]=await Promise.all([e.getSolutions(["solutionid","uniquename","friendlyname","version","ismanaged","_publisherid_value"],c),fe(e,"publishers?$select=publisherid,uniquename,customizationprefix",c).catch(()=>[])]),i=new Map(u.map(r=>[gt(r.publisherid),String(r.customizationprefix??"").toLowerCase()]));return t.value.map(r=>{const s=r._publisherid_value?gt(r._publisherid_value):null;return{id:gt(r.solutionid),uniqueName:String(r.uniquename??""),friendlyName:Qt(r.friendlyname)??String(r.uniquename??""),version:String(r.version??""),isManaged:!!r.ismanaged,publisherId:s,prefix:s?i.get(s)??"":""}}).sort((r,s)=>r.friendlyName.localeCompare(s.friendlyName))}async function Ne(e,c){const u=(await e.queryData(`solutions?$select=solutionid,uniquename,ismanaged&$filter=solutionid eq ${te(c,"solution id")}`)).value[0];return u?{isManaged:!!u.ismanaged,uniqueName:String(u.uniquename??"")}:null}async function ze(e,c){return(await fe(e,`solutioncomponents?$select=solutioncomponentid,objectid,componenttype,rootcomponentbehavior,_rootsolutioncomponentid_value&$filter=_solutionid_value eq ${te(c,"solution id")}`)).map(u=>({rowId:gt(u.solutioncomponentid),objectId:gt(u.objectid),type:Number(u.componenttype??0),behavior:u.rootcomponentbehavior==null?null:Number(u.rootcomponentbehavior),rootRowId:u._rootsolutioncomponentid_value?gt(u._rootsolutioncomponentid_value):null}))}function yn(e){const c=e;if(!c)return[];const t=c.EntityCollection;if(Array.isArray(t))return t;if(t&&typeof t=="object"){const u=t.Entities??t.value;if(Array.isArray(u))return u}return Array.isArray(c.value)?c.value:[]}const Pt=(e,c)=>e[c]??e[`_${c}_value`];async function bn(e,c,t){const u=te(c,"component id");if(!Number.isInteger(t))throw new Error(`bad component type ${t}`);const i=await e.queryData(`RetrieveRequiredComponents(ObjectId=${u},ComponentType=${t})`);return yn(i).map(r=>({requiredId:gt(Pt(r,"requiredcomponentobjectid")),requiredType:Number(Pt(r,"requiredcomponenttype")??0),requiredParentId:Pt(r,"requiredcomponentparentid")?gt(Pt(r,"requiredcomponentparentid")):null,requiredBaseSolutionId:Pt(r,"requiredcomponentbasesolutionid")?gt(Pt(r,"requiredcomponentbasesolutionid")):null}))}async function wn(e,c){const t=await ee(e,c,"objectid",i=>`solutioncomponents?$select=objectid,componenttype,_solutionid_value&$filter=${i}`),u=new Map;for(const i of t){const r=gt(i.objectid),s=u.get(r)??[],o=gt(i._solutionid_value);o&&!s.includes(o)&&s.push(o),u.set(r,s)}return u}class Re{constructor(){de(this,"entities",null);de(this,"attributes",new Map);de(this,"names",new Map)}async entitiesById(c){if(this.entities)return this.entities;const t=await c.getAllEntitiesMetadata(["LogicalName","MetadataId","PrimaryNameAttribute"]);return this.entities=new Map(t.value.map(u=>[gt(u.MetadataId),{id:gt(u.MetadataId),logicalName:String(u.LogicalName??""),primaryName:Qt(u.PrimaryNameAttribute)}])),this.entities}async entityByName(c,t){const u=await this.entitiesById(c);for(const i of u.values())if(i.logicalName===t)return i}async attributesOf(c,t){const u=this.attributes.get(t);if(u)return u;const r=(await c.getEntityRelatedMetadata(t,"Attributes",["LogicalName","MetadataId","RequiredLevel"])).value.map(s=>{var o;return{id:gt(s.MetadataId),logicalName:String(s.LogicalName??""),requiredLevel:String(((o=s.RequiredLevel)==null?void 0:o.Value)??s.RequiredLevel??"None")}});return this.attributes.set(t,r),r}async protectedColumns(c,t){const u=await this.entityByName(c,t),i=await this.attributesOf(c,t).catch(()=>[]),r=new Set;u!=null&&u.primaryName&&r.add(u.primaryName);for(const s of i)(s.requiredLevel==="ApplicationRequired"||s.requiredLevel==="SystemRequired")&&r.add(s.logicalName);return[...r]}}const Oe={[it.View]:["savedqueries","savedqueryid","name","returnedtypecode"],[it.Form]:["systemforms","formid","name","objecttypecode"],[it.Chart]:["savedqueryvisualizations","savedqueryvisualizationid","name","primaryentitytypecode"],[it.WebResource]:["webresourceset","webresourceid","name"],[it.Workflow]:["workflows","workflowid","name","primaryentity"],[it.SiteMap]:["sitemaps","sitemapid","sitemapname"],[it.AppModule]:["appmodules","appmoduleid","name"],[it.PluginStep]:["sdkmessageprocessingsteps","sdkmessageprocessingstepid","name"],20:["roles","roleid","name"],300:["canvasapps","canvasappid","name"],372:["connectionreferences","connectionreferenceid","connectionreferencelogicalname"],380:["environmentvariabledefinitions","environmentvariabledefinitionid","schemaname"]};async function vn(e,c,t){var x;const u=(y,v)=>`${y}:${v}`,i=new Map,r=t.filter(y=>{const v=c.names.get(u(y.type,y.id));return v&&i.set(u(y.type,y.id),v),!v});if(!r.length)return i;const s=y=>{i.set(u(y.type,y.id),y),c.names.set(u(y.type,y.id),y)},o=await c.entitiesById(e).catch(()=>new Map);for(const y of r.filter(v=>v.type===it.Entity)){const v=o.get(y.id);v&&s({type:y.type,id:y.id,name:v.logicalName,table:v.logicalName})}const p=new Map;for(const y of r.filter(v=>v.type===it.Attribute)){const v=y.parentId??"";p.set(v,[...p.get(v)??[],y])}for(const[y,v]of p){const d=(x=o.get(y))==null?void 0:x.logicalName;if(!d)continue;const m=await c.attributesOf(e,d).catch(()=>[]);for(const l of v){const g=m.find(h=>h.id===l.id);g&&s({type:l.type,id:l.id,name:g.logicalName,table:d})}}const w=new Map;for(const y of r)Oe[y.type]&&w.set(y.type,[...w.get(y.type)??[],y.id]);await Promise.all([...w].map(async([y,v])=>{const[d,m,l,g]=Oe[y],h=await ee(e,v,m,f=>`${d}?$select=${[m,l,g].filter(Boolean).join(",")}&$filter=${f}`).catch(()=>[]);for(const f of h)s({type:y,id:gt(f[m]),name:Qt(f[l])??gt(f[m]),table:g?Qt(f[g])??void 0:void 0})}));for(const y of r.filter(v=>v.type===it.EntityRelationship||v.type===it.Relationship))try{const v=await e.queryData(`RelationshipDefinitions(${te(y.id)})?$select=SchemaName`);v!=null&&v.SchemaName&&s({type:y.type,id:y.id,name:String(v.SchemaName)})}catch{}for(const y of r)i.has(u(y.type,y.id))||i.set(u(y.type,y.id),{type:y.type,id:y.id,name:y.id});return i}async function $e(e,c){return(await ee(e,c,"formid",u=>`systemforms?$select=formid,name,objecttypecode,formxml&$filter=${u}`)).map(u=>({id:gt(u.formid),name:String(u.name??""),table:String(u.objecttypecode??""),formxml:String(u.formxml??"")}))}async function Be(e,c){return(await ee(e,c,"savedqueryid",u=>`savedqueries?$select=savedqueryid,name,returnedtypecode,fetchxml,layoutxml&$filter=${u}`)).map(u=>({id:gt(u.savedqueryid),name:String(u.name??""),table:String(u.returnedtypecode??""),fetchxml:String(u.fetchxml??""),layoutxml:String(u.layoutxml??"")}))}async function _n(e){var c;try{const t=await e.execute({operationName:"RetrieveCurrentOrganization",operationType:"function",parameters:{AccessType:"Microsoft.Dynamics.CRM.EndpointAccessType'Default'"}}),u=(c=t==null?void 0:t.Detail)==null?void 0:c.EnvironmentId;return typeof u=="string"&&u?u:null}catch{return null}}const ct=e=>(e??"").trim().toLowerCase();function pe(e,c){const t=new DOMParser().parseFromString(e,"application/xml");if(t.getElementsByTagName("parsererror").length)throw new Error(`${c}: invalid XML`);return t}function me(e,c){const t=/^?\s*<\?xml[^?]*\?>\s*/.exec(c),u=new XMLSerializer().serializeToString(e).replace(/^<\?xml[^?]*\?>\s*/,"");return(t?t[0]:"")+u}const mt=(e,c)=>Array.from(e.getElementsByTagName(c)),qt=(e,c)=>Array.from(e.children).filter(t=>!c||t.localName===c);function Ct(e){var t,u;const c=e.previousSibling;c&&c.nodeType===3&&!(c.nodeValue??"").trim()&&((t=c.parentNode)==null||t.removeChild(c)),(u=e.parentNode)==null||u.removeChild(e)}function Zt(e){if(e.children.length===0&&!(e.textContent??"").trim())for(;e.firstChild;)e.removeChild(e.firstChild)}const ne=(e,c)=>{for(let t=e.parentElement;t;t=t.parentElement)if(t.localName===c)return t;return null},ge=e=>{var t;return e&&(((t=e.getElementsByTagName("label")[0])==null?void 0:t.getAttribute("description"))||e.getAttribute("name")||e.getAttribute("id"))||""},kn=e=>new Set(e.map(c=>{var t;return(t=/^([a-z0-9]+_)/.exec(c))==null?void 0:t[1]}).filter(c=>!!c));function xn(e,c,t,u=[]){var k;const i=new Set(c.map(ct)),r=new Set(t.map(ct)),s=new Set(u.map(ct)),o=[],p=[],w=[],x=_=>!o.includes(_)&&o.push(_),y=(_,C)=>!p.some(A=>A.name===_)&&p.push({name:_,reason:C}),v=pe(e,"formxml"),d=new Set,m=new Set,l=new Set,g=new Set;for(const _ of mt(v,"control")){if(!_.parentNode||!v.documentElement.contains(_))continue;const C=ct(_.getAttribute("datafieldname"));let A=null;if(C&&i.has(C)){if(r.has(C)){y(C,"protected: primary name or ApplicationRequired column");continue}A=C}else if(s.size){const $=_.getElementsByTagName("parameters")[0];if($){const U=ct((k=$.getElementsByTagName("TargetEntityType")[0])==null?void 0:k.textContent),Y=mt($,"QuickFormId").map(E=>ct(E.getAttribute("entityname"))).find(E=>s.has(E));U&&s.has(U)?A=`subgrid ${_.getAttribute("id")??"?"} (${U})`:Y&&(A=`quickview ${_.getAttribute("id")??"?"} (${Y})`)}}if(!A)continue;const N=ne(_,"cell"),F=N&&ne(N,"row");for(const $ of[_.getAttribute("id"),_.getAttribute("uniqueid")])$&&d.add(ct($));C&&A===C&&m.add(C),x(A),N?(Ct(N),F&&l.add(F)):Ct(_)}for(const _ of l){const C=ne(_,"section");if(C&&g.add(C),qt(_,"cell").length===0){const A=_.parentElement;Ct(_),A&&Zt(A)}}const h=new Set;for(const _ of g){const C=ne(_,"tab");if(C&&h.add(C),!mt(_,"row").some(N=>qt(N,"cell").some(F=>F.getElementsByTagName("control").length>0))){w.push(`Section "${ge(_)}"${C?` in tab "${ge(C)}"`:""} became empty and was removed.`);const N=_.parentElement;Ct(_),N&&Zt(N)}}for(const _ of h)mt(_,"control").length===0&&w.push(`Tab "${ge(_)}" is now empty (kept; remove or hide it by hand).`);for(const _ of mt(v,"controlDescription")){const C=ct(_.getAttribute("forControl"));if(C&&d.has(C)){const N=_.parentElement;Ct(_),N&&Zt(N);continue}const A=mt(_,"*").filter(N=>N.children.length===0).map(N=>ct(N.textContent)).find(N=>m.has(N));A&&w.push(`Custom control (controlDescription for ${_.getAttribute("forControl")}) references removed column ${A}; review it by hand.`)}for(const _ of mt(v,"event")){const C=ct(_.getAttribute("attribute"));if(C&&m.has(C)){const A=mt(_,"Handler").map(N=>`${N.getAttribute("libraryName")}:${N.getAttribute("functionName")}`);w.push(`Event "${_.getAttribute("name")}" on removed column ${C} still has handlers${A.length?` (${A.join(", ")})`:""}; review the form events.`)}}const f=kn([...m,...s]);if(o.length&&f.size){const _=new Set,C=[...mt(v,"Library").map(A=>A.getAttribute("name")??""),...mt(v,"Handler").map(A=>A.getAttribute("libraryName")??"")];for(const A of C){const N=ct(A);!N||_.has(N)||(_.add(N),[...f].some(F=>N.startsWith(F)||N.includes("/"+F))&&w.push(`Form library "${A}" belongs to the same publisher as removed components; it may still depend on them.`))}}return{xml:o.length?me(v,e):e,removed:o,kept:p,warnings:w}}function Sn(e,c,t,u){const i=new Set(t.map(ct)),r=new Set(u.map(ct)),s=[],o=[],p=new Set,w=new Set;let x=!1,y=e;if(e.trim()){const d=pe(e,"fetchxml"),m=mt(d,"entity")[0],l=m?qt(m,"order").length:0;for(const _ of mt(d,"link-entity")){if(!d.documentElement.contains(_))continue;const C=ct(_.getAttribute("name")),A=ct(_.getAttribute("alias"));if(r.has(C)){A&&p.add(A);for(const N of mt(_,"link-entity"))N.getAttribute("alias")&&p.add(ct(N.getAttribute("alias")));s.push(`link-entity ${C}${A?` (${A})`:""}`),Ct(_),x=!0}else A&&w.add(A)}for(const _ of mt(d,"link-entity"))for(const C of["from","to"]){const A=ct(_.getAttribute(C));A&&i.has(A)&&o.push(`link-entity ${_.getAttribute("name")} joins ${C}="${A}", a removed column; the view will break until this join is fixed.`)}for(const _ of mt(d,"attribute")){const C=ct(_.getAttribute("name"));i.has(C)&&(s.push(`attribute ${C}`),Ct(_),x=!0)}let g=0;for(const _ of mt(d,"order")){const C=ct(_.getAttribute("attribute")),A=ct(_.getAttribute("entityname"));(i.has(C)||A&&p.has(A))&&(s.push(`order ${A?A+".":""}${C}`),Ct(_),g++,x=!0)}const h=new Set;let f=0;for(const _ of mt(d,"condition")){const C=ct(_.getAttribute("attribute")),A=ct(_.getAttribute("entityname"));if(i.has(C)||A&&p.has(A)){s.push(`condition ${A?A+".":""}${C} ${_.getAttribute("operator")??""}`.trim());const N=_.parentElement;Ct(_),(N==null?void 0:N.localName)==="filter"&&h.add(N),f++,x=!0}}const k=[...h];for(;k.length;){const _=k.shift();if(!_.parentNode||qt(_).some(A=>A.localName==="condition"||A.localName==="filter"))continue;const C=_.parentElement;Ct(_),C&&(Zt(C),C.localName==="filter"&&k.push(C))}f&&o.push(`${f} filter condition(s) removed: the view now returns a different (usually larger) set of rows. Review the filter.`),g&&l>0&&m&&qt(m,"order").length===0&&o.push("The view's only sort order was removed; it will fall back to the default order."),m&&x&&qt(m,"attribute").length===0&&!m.getElementsByTagName("all-attributes").length&&o.push("The root entity has no attributes left in the view."),x&&(y=me(d,e))}let v=c;if(c.trim()){const d=pe(c,"layoutxml");let m=!1;for(const l of mt(d,"cell")){const g=ct(l.getAttribute("name"));if(!g)continue;const h=g.indexOf("."),f=h>=0?g.slice(0,h):"",k=h>=0?g.slice(h+1):g;if(f?p.has(f)||w.has(f)&&i.has(k):i.has(k)){s.push(`cell ${g}`);const C=l.parentElement;Ct(l),C&&Zt(C),m=!0}}for(const l of mt(d,"grid")){const g=ct(l.getAttribute("jump"));g&&i.has(g)&&o.push(`Layout jump column "${g}" was removed; set another primary column for the grid.`)}m&&(v=me(d,c))}return{fetchxml:y,layoutxml:v,removed:s,warnings:o}}const Cn=e=>({type:e.type,id:e.objectId,name:e.name??e.objectId,table:e.table}),re=(e,c)=>[...new Set(e.required.filter(t=>t.type===c).map(t=>t.name))];async function En(e,c,t,u){var g;const i=[],r=u.filter(h=>h.fix==="edit-form"),s=u.filter(h=>h.fix==="edit-view"),[o,p]=await Promise.all([r.length?$e(e,r.map(h=>h.finding.dependent.id)):Promise.resolve([]),s.length?Be(e,s.map(h=>h.finding.dependent.id)):Promise.resolve([])]),w=[];for(const h of r){const f=o.find(_=>_.id===h.finding.dependent.id);if(!f){i.push({name:h.finding.dependent.name,reason:"form not found"});continue}const k=await c.protectedColumns(e,f.table);try{const _=xn(f.formxml,re(h.finding,it.Attribute),k,re(h.finding,it.Entity));_.removed.length?w.push({form:f,after:_.xml,removed:_.removed,kept:_.kept,warnings:_.warnings}):i.push({name:f.name,reason:`nothing to strip${_.kept.length?`: kept ${_.kept.map(C=>`${C.name} (${C.reason})`).join(", ")}`:""}`})}catch(_){i.push({name:f.name,reason:_.message})}}const x=[];for(const h of s){const f=p.find(k=>k.id===h.finding.dependent.id);if(!f){i.push({name:h.finding.dependent.name,reason:"view not found"});continue}try{const k=Sn(f.fetchxml,f.layoutxml,re(h.finding,it.Attribute),re(h.finding,it.Entity));k.removed.length?x.push({view:f,after:{fetchxml:k.fetchxml,layoutxml:k.layoutxml},removed:k.removed,warnings:k.warnings}):i.push({name:f.name,reason:"nothing to strip"})}catch(k){i.push({name:f.name,reason:k.message})}}const y=new Set([...w.map(h=>h.form.id),...x.map(h=>h.view.id)]),v=t.solution.prefix?`${t.solution.prefix}_`:null,d=[];for(const h of u.filter(f=>f.fix==="shell")){const f=(g=h.finding.fixes.find(A=>A.kind==="shell"))==null?void 0:g.root;if(!f||d.some(A=>A.root.id===f.id))continue;const k=t.components.find(A=>A.type===it.Entity&&A.objectId===f.id),_=new Set(t.findings.filter(A=>A.dependent.selfOwned).map(A=>A.dependent.id)),C=t.components.filter(A=>k&&A.rootRowId===k.rowId&&A.rowId!==k.rowId).map(A=>{const N=(A.name??"").toLowerCase();return _.has(A.objectId)?{component:A,keep:!1,why:"belongs to a managed solution in scope"}:y.has(A.objectId)?{component:A,keep:!0,why:"edited in this plan"}:v&&N.startsWith(v)?{component:A,keep:!0,why:`your prefix ${v}`}:{component:A,keep:!1,why:"not yours"}}).sort((A,N)=>Number(N.keep)-Number(A.keep)||A.component.type-N.component.type||(A.component.name??"").localeCompare(N.component.name??""));d.push({root:{...f,behavior:0},leaving:C})}const m=new Set(d.map(h=>{var f;return(f=t.components.find(k=>k.type===it.Entity&&k.objectId===h.root.id))==null?void 0:f.rowId})),l=[];for(const h of u.filter(f=>f.fix==="remove")){const f=t.components.find(k=>k.objectId===h.finding.dependent.id&&k.type===h.finding.dependent.type);if(f!=null&&f.rootRowId&&m.has(f.rootRowId)){i.push({name:h.finding.dependent.name,reason:"leaves with the shell conversion of its table"});continue}l.some(k=>k.id===h.finding.dependent.id)||l.push(h.finding.dependent)}for(const h of u.filter(f=>f.fix==="report"))i.push({name:h.finding.dependent.name,reason:"report only"});return{diagnosis:t,shells:d,removes:l,forms:w,views:x,skipped:i}}function Te(e){const c=[];for(const u of e.shells){c.push({kind:"remove",component:u.root,reason:`convert ${u.root.name} to a shell`}),c.push({kind:"add",component:u.root,doNotIncludeSubcomponents:!0,reason:"re-add as shell (no subcomponents)"});for(const i of u.leaving.filter(r=>r.keep))c.push({kind:"add",component:Cn(i.component),doNotIncludeSubcomponents:!1,reason:`keep: ${i.why}`})}for(const u of e.removes)c.push({kind:"remove",component:u,reason:`remove ${vt(u.type).toLowerCase()}`});for(const u of e.forms)c.push({kind:"update-form",edit:u});for(const u of e.views)c.push({kind:"update-view",edit:u});const t=[...new Set([...e.forms.map(u=>u.form.table),...e.views.map(u=>u.view.table)].filter(Boolean))].sort();return t.length&&c.push({kind:"publish",tables:t}),c}function An(e){const c=t=>t.replace(/[<>&"']/g,u=>`&#${u.charCodeAt(0)};`);return`<importexportxml><entities>${e.map(t=>`<entity>${c(t)}</entity>`).join("")}</entities></importexportxml>`}const In=(e,c)=>({operationName:"RemoveSolutionComponent",operationType:"action",parameters:{ComponentId:e.id,ComponentType:e.type,SolutionUniqueName:c}}),Nn=(e,c,t)=>({operationName:"AddSolutionComponent",operationType:"action",parameters:{ComponentId:e.id,ComponentType:e.type,SolutionUniqueName:c,DoNotIncludeSubcomponents:t,AddRequiredComponents:!1}});async function je(e,c,t,u){const i=[];let r=!1,s=!1;for(let o=0;o<c.length;o++){const p=c[o];if(u==null||u(o,c.length),r&&!(p.kind==="publish"&&s)){i.push({op:p,ok:!1,skipped:!0,error:"not run: an earlier step failed"});continue}try{p.kind==="remove"?await e.execute(In(p.component,t)):p.kind==="add"?await e.execute(Nn(p.component,t,p.doNotIncludeSubcomponents)):p.kind==="update-form"?(await e.update("systemform",p.edit.form.id,{formxml:p.edit.after}),s=!0):p.kind==="update-view"?(await e.update("savedquery",p.edit.view.id,{fetchxml:p.edit.after.fetchxml,layoutxml:p.edit.after.layoutxml}),s=!0):p.kind==="publish"&&await e.execute({operationName:"PublishXml",operationType:"action",parameters:{ParameterXml:An(p.tables)}}),i.push({op:p,ok:!0})}catch(w){r=!0,i.push({op:p,ok:!1,error:w.message??String(w)})}}return u==null||u(c.length,c.length),i}function ye(e){switch(e.kind){case"remove":return`RemoveSolutionComponent ${vt(e.component.type)} ${e.component.name}`;case"add":return`AddSolutionComponent ${vt(e.component.type)} ${e.component.name}${e.doNotIncludeSubcomponents?" (DoNotIncludeSubcomponents)":""}`;case"update-form":return`Update form ${e.edit.form.name} (${e.edit.form.table}): formxml`;case"update-view":return`Update view ${e.edit.view.name} (${e.edit.view.table}): fetchxml + layoutxml`;case"publish":return`PublishXml ${e.tables.join(", ")}`}}const Le=e=>e.replace(/>\s*</g,`>
|
|
2
|
-
<`).split(`
|
|
3
|
-
`);function zn(e,c,t=2){const u=Le(e),i=Le(c);let r=0;for(;r<u.length&&r<i.length&&u[r]===i[r];)r++;let s=0;for(;s<u.length-r&&s<i.length-r&&u[u.length-1-s]===i[i.length-1-s];)s++;const o=u.slice(r,u.length-s),p=i.slice(r,i.length-s),w=[];if(o.length*p.length>4e6)w.push(...o.map(d=>({t:"-",s:d})),...p.map(d=>({t:"+",s:d})));else{const d=o.length,m=p.length,l=Array.from({length:d+1},()=>new Uint32Array(m+1));for(let f=d-1;f>=0;f--)for(let k=m-1;k>=0;k--)l[f][k]=o[f]===p[k]?l[f+1][k+1]+1:Math.max(l[f+1][k],l[f][k+1]);let g=0,h=0;for(;g<d||h<m;)g<d&&h<m&&o[g]===p[h]?(w.push({t:" ",s:o[g++]}),h++):h<m&&(g>=d||l[g][h+1]>=l[g+1][h])?w.push({t:"+",s:p[h++]}):w.push({t:"-",s:o[g++]})}const x=[...u.slice(0,r).map(d=>({t:" ",s:d})),...w,...u.slice(u.length-s).map(d=>({t:" ",s:d}))],y=x.map(()=>!1);x.forEach((d,m)=>{if(d.t!==" ")for(let l=-t;l<=t;l++)x[m+l]&&(y[m+l]=!0)});const v=[];return x.forEach((d,m)=>{y[m]?v.push(d):(v.length===0||v[v.length-1].t!=="…")&&v.push({t:"…",s:""})}),v}const De="sss-dependency-cleaner-backup";function Rn(e,c,t){const u=new Map(e.components.map(i=>[i.rowId,i]));return{kind:De,version:1,takenAt:new Date().toISOString(),environment:{name:e.environment.name,url:e.environment.url},solution:{id:e.solution.id,uniqueName:e.solution.uniqueName,friendlyName:e.solution.friendlyName},membership:e.components.map(i=>{var r;return{objectId:i.objectId,type:i.type,behavior:i.behavior,rootObjectId:i.rootRowId?((r=u.get(i.rootRowId))==null?void 0:r.objectId)??null:null,name:i.name??i.objectId}}),forms:c.forms.map(i=>i.form),views:c.views.map(i=>i.view),operations:t.map(ye)}}function On(e,c=new Date){const t=c.toISOString().replace(/[:.]/g,"-").slice(0,19);return`dependency-cleaner-backup-${e.replace(/[^a-z0-9._-]+/gi,"_")}-${t}.json`}function $n(e){var t;let c;try{c=JSON.parse(e)}catch(u){throw new Error(`not JSON: ${u.message}`)}if((c==null?void 0:c.kind)!==De)throw new Error("not a Dependency Cleaner backup");if(c.version!==1)throw new Error(`unsupported backup version ${String(c.version)}`);if(!((t=c.solution)!=null&&t.uniqueName)||!Array.isArray(c.membership)||!Array.isArray(c.forms)||!Array.isArray(c.views))throw new Error("backup is incomplete");return c}async function Bn(e,c,t,u){const i=t.find(m=>m.uniqueName.toLowerCase()===c.solution.uniqueName.toLowerCase());if(!i)throw new Error(`solution ${c.solution.uniqueName} is not in this environment`);if(i.isManaged)throw new Error(`solution ${i.uniqueName} is managed: writes are refused`);const r=[];c.environment.url&&u&&c.environment.url.replace(/\/+$/,"").toLowerCase()!==u.replace(/\/+$/,"").toLowerCase()&&r.push(`Backup was taken in ${c.environment.name} (${c.environment.url}), not this environment.`);const s=await ze(e,i.id),o=(m,l)=>`${m}:${l}`,p=new Map(s.map(m=>[o(m.type,m.objectId),m])),w=[],x=new Set;for(const m of c.membership.filter(l=>!l.rootObjectId||l.rootObjectId===l.objectId)){const l=p.get(o(m.type,m.objectId)),g={type:m.type,id:m.objectId,name:m.name};l?m.type===it.Entity&&m.behavior===0&&l.behavior!==0&&(w.push({kind:"remove",component:g,reason:"shell → back to all assets"}),w.push({kind:"add",component:g,doNotIncludeSubcomponents:!1,reason:"re-add with all subcomponents"}),x.add(m.objectId)):(w.push({kind:"add",component:g,doNotIncludeSubcomponents:m.behavior!==0,reason:"re-add removed component"}),m.type===it.Entity&&m.behavior===0&&x.add(m.objectId))}for(const m of c.membership.filter(l=>l.rootObjectId&&l.rootObjectId!==l.objectId))p.has(o(m.type,m.objectId))||x.has(m.rootObjectId)||w.push({kind:"add",component:{type:m.type,id:m.objectId,name:m.name},doNotIncludeSubcomponents:!1,reason:"re-add removed subcomponent"});const[y,v]=await Promise.all([c.forms.length?$e(e,c.forms.map(m=>m.id)):Promise.resolve([]),c.views.length?Be(e,c.views.map(m=>m.id)):Promise.resolve([])]),d=new Set;for(const m of c.forms){const l=y.find(g=>g.id===m.id);if(!l){r.push(`Form ${m.name} no longer exists; not restored.`);continue}l.formxml!==m.formxml&&(w.push({kind:"update-form",edit:{form:l,after:m.formxml,removed:[],kept:[],warnings:[]}}),d.add(l.table||m.table))}for(const m of c.views){const l=v.find(g=>g.id===m.id);if(!l){r.push(`View ${m.name} no longer exists; not restored.`);continue}l.fetchxml===m.fetchxml&&l.layoutxml===m.layoutxml||(w.push({kind:"update-view",edit:{view:l,after:{fetchxml:m.fetchxml,layoutxml:m.layoutxml},removed:[],warnings:[]}}),d.add(l.table||m.table))}return d.size&&w.push({kind:"publish",tables:[...d].filter(Boolean).sort()}),{solution:i,ops:w,notes:r}}function Tn(e){return[...new Set(e.split(/[\s,;]+/).map(c=>c.trim().toLowerCase()).filter(Boolean))]}function Ht(e,c,t){const u=t.toLowerCase();return e.some(i=>c?c.prefix.toLowerCase()===i||c.uniqueName.toLowerCase().startsWith(i):u.startsWith(`${i}_`))}const Dt=e=>[...new Set(e.map(c=>c.name))].slice(0,4).join(", ")+(e.length>4?"…":"");function jn(e,c,t,u){var y,v;const i=(d,m)=>({cause:d,fixes:[{kind:"report",label:"Report only: open in maker portal",link:u,note:m}]}),r=e.root&&e.root.behavior===0?e.root:null,s=()=>r?{kind:"shell",label:`Convert table ${r.name} to a shell (remove + add without subcomponents)`,root:r}:null,o={kind:"remove",label:`Remove this ${vt(e.type).toLowerCase()} from the solution`},p=Ht(t,null,e.name),w=(d,...m)=>({cause:d,fixes:m.filter(l=>!!l)}),x=((v=(y=c.find(d=>d.id===e.id))==null?void 0:y.solution)==null?void 0:v.uniqueName)??"a managed solution";if(e.selfOwned&&e.type===it.Entity)return w(`Table ${e.name} belongs to ${x}. Shipping it, even as a shell, needs that solution in the target.`,o,{kind:"report",label:"Report only: open in maker portal",link:u});if(e.selfOwned)return w(r?`${vt(e.type)} ${e.name} belongs to ${x} and came in with table ${r.name}, which is in the solution with all assets.`:`${vt(e.type)} ${e.name} belongs to ${x} and is included directly.`,s(),r?null:o);switch(e.type){case it.Entity:return e.behavior===0?w(`Table added with all assets: its columns, forms and views come along, including ones that need ${Dt(c)}.`,s()??{kind:"shell",label:`Convert table ${e.name} to a shell`,root:{...e,behavior:0}},o):w(`The table itself requires ${Dt(c)}.`,o,{kind:"report",label:"Report only: open in maker portal",link:u});case it.Attribute:return p?w(r?`Column ${e.name} comes with table ${r.name}, which is in the solution with all assets.`:`Column ${e.name} is included directly.`,s(),r?null:o):i(`Your column needs ${Dt(c)} (for example a lookup to that table). This is a real dependency: the target needs the app, or the column has to be changed by hand.`);case it.Relationship:case it.EntityRelationship:return i(`Relationship to ${Dt(c)}. This is a real dependency: the target needs the app, or the relationship has to be deleted by hand.`);case it.Form:return w(`Form uses ${Dt(c)} (a field, subgrid, quick view or library).`,{kind:"edit-form",label:"Edit form: remove those fields (backup first)"},s(),r?null:o);case it.View:return w(`View uses ${Dt(c)} (a column, condition or link-entity).`,{kind:"edit-view",label:"Edit view: strip those columns and link-entities (backup first)"},s(),r?null:o);default:return i(`${vt(e.type)} references ${Dt(c)}. Not edited automatically in v1.`,"Sitemap, app, ribbon, chart, process, web resource and plugin step references are fixed by hand.")}}const Ln=4,Dn=new Set(["default","active","basic"]);class Fe extends Error{constructor(){super("Diagnosis cancelled")}}const Rt=(e,c)=>`${e}:${c}`;async function Fn(e){var g,h;const c=e.cancelled??(()=>!1),t=await ze(e.api,e.solution.id),u=new Set(t.map(f=>f.objectId)),i=new Map(t.map(f=>[f.rowId,f])),r=[],s=new Map;let o=0;if((g=e.onProgress)==null||g.call(e,0,t.length),await gn(t,Ln,async f=>{var C;const k=Rt(f.type,f.objectId);let _=e.reqCache.get(k);if(!_)try{_=await bn(e.api,f.objectId,f.type),e.reqCache.set(k,_)}catch(A){r.push({component:k,error:A.message??String(A)}),_=[]}s.set(f,_.filter(A=>A.requiredId&&A.requiredId!==f.objectId)),(C=e.onProgress)==null||C.call(e,++o,t.length)},c),c())throw new Fe;const p=[...new Set([...s.values()].flat().map(f=>f.requiredId).concat(t.map(f=>f.objectId)))],w=p.length?await wn(e.api,p):new Map,x=new Map(e.allSolutions.map(f=>[f.id,f])),y=f=>({uniqueName:f.uniqueName,friendlyName:f.friendlyName,prefix:f.prefix,isManaged:f.isManaged}),v=t.map(f=>{const k=f.rootRowId?i.get(f.rootRowId):void 0;return{type:f.type,id:f.objectId,parentId:(k==null?void 0:k.type)===it.Entity?k.objectId:null}});for(const f of s.values())for(const k of f)v.push({type:k.requiredType,id:k.requiredId,parentId:k.requiredParentId});const d=await vn(e.api,e.meta,v),m=(f,k)=>d.get(Rt(f,k))??{type:f,id:k,name:k};for(const f of t){const k=m(f.type,f.objectId);f.name=k.name,f.table=k.table}const l=[];for(const[f,k]of s){const _=[],C=new Set,A={requiredId:f.objectId,requiredType:f.type,requiredParentId:null,requiredBaseSolutionId:null},N=[A,...k];let F=!1;for(const T of N){const a=Rt(T.requiredType,T.requiredId);if(C.has(a))continue;C.add(a);const L=m(T.requiredType,T.requiredId),tt=(w.get(T.requiredId)??[]).map(z=>x.get(z)).filter(z=>!!z&&z.isManaged&&z.id!==e.solution.id&&!Dn.has(z.uniqueName.toLowerCase()));if(!tt.length&&u.has(T.requiredId)||T===A&&!tt.length)continue;const q=T.requiredBaseSolutionId?x.get(T.requiredBaseSolutionId):void 0,nt=(q!=null&&q.isManaged?q:void 0)??tt.find(z=>Ht(e.filter,z,L.name))??tt[0]??null,W=Ht(e.filter,nt,L.name),et=!!nt&&!!((h=e.targetSolutions)!=null&&h.has(nt.uniqueName.toLowerCase())),O=!!e.targetSolutions&&!!nt&&!et;!W&&!O||(T===A&&(F=!0),_.push({...L,solution:nt?y(nt):null,solutions:tt.map(z=>z.uniqueName),blocker:!et}))}if(!_.length)continue;const $=m(f.type,f.objectId),U=f.type===it.Entity?f:f.rootRowId?i.get(f.rootRowId):void 0,Y=U&&U.type===it.Entity?{...m(U.type,U.objectId),behavior:U.behavior??0}:null,E=jn({...$,behavior:f.behavior,root:Y,selfOwned:F},_,e.filter,e.link($));l.push({key:Rt(f.type,f.objectId),dependent:{...$,rootBehavior:(Y==null?void 0:Y.behavior)??null,rootTable:Y==null?void 0:Y.name,selfOwned:F},required:_.map(({blocker:T,...a})=>a),cause:E.cause,fixes:E.fixes,status:_.some(T=>T.blocker)?"blocker":"safe"})}return l.sort((f,k)=>(f.status===k.status?0:f.status==="blocker"?-1:1)||f.dependent.type-k.dependent.type||f.dependent.name.localeCompare(k.dependent.name)),{solution:e.solution,environment:e.environment,target:e.target,filter:e.filter,components:t,findings:l,errors:r,takenAt:new Date().toISOString()}}function Pe(e){let c=e==null?"":String(e);return/^[=+\-@\t\r]/.test(c)&&(c=`'${c}`),/[",\r\n]/.test(c)?`"${c.replace(/"/g,'""')}"`:c}function Pn(e){var t;const c=[["status","dependent type","dependent","table","cause","required type","required","required solution","fixes"].map(Pe).join(",")];for(const u of e.findings)for(const i of u.required)c.push([u.status,vt(u.dependent.type),u.dependent.name,u.dependent.table??u.dependent.rootTable??"",u.cause,vt(i.type),i.name,((t=i.solution)==null?void 0:t.uniqueName)??"",u.fixes.map(r=>r.kind).join(" | ")].map(Pe).join(","));return c.join(`
|
|
4
|
-
`)+`
|
|
5
|
-
`}function qn(e){return JSON.stringify({kind:"sss-dependency-cleaner-findings",version:1,takenAt:e.takenAt,environment:e.environment,target:e.target,solution:{uniqueName:e.solution.uniqueName,friendlyName:e.solution.friendlyName,version:e.solution.version},filter:e.filter,findings:e.findings,errors:e.errors},null,2)}const qe=e=>e.replace(/[^a-z0-9._-]+/gi,"_").replace(/^_+|_+$/g,"")||"solution";var ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Un(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function oe(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ue={exports:{}};/*!
|
|
6
|
-
|
|
7
|
-
JSZip v3.10.2 - A JavaScript class for generating and reading zip files
|
|
8
|
-
<http://stuartk.com/jszip>
|
|
9
|
-
|
|
10
|
-
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
11
|
-
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
12
|
-
|
|
13
|
-
JSZip uses the library pako released under the MIT license :
|
|
14
|
-
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
15
|
-
*/(function(e,c){(function(t){e.exports=t()})(function(){return function t(u,i,r){function s(w,x){if(!i[w]){if(!u[w]){var y=typeof oe=="function"&&oe;if(!x&&y)return y(w,!0);if(o)return o(w,!0);var v=new Error("Cannot find module '"+w+"'");throw v.code="MODULE_NOT_FOUND",v}var d=i[w]={exports:{}};u[w][0].call(d.exports,function(m){var l=u[w][1][m];return s(l||m)},d,d.exports,t,u,i,r)}return i[w].exports}for(var o=typeof oe=="function"&&oe,p=0;p<r.length;p++)s(r[p]);return s}({1:[function(t,u,i){var r=t("./utils"),s=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(p){for(var w,x,y,v,d,m,l,g=[],h=0,f=p.length,k=f,_=r.getTypeOf(p)!=="string";h<p.length;)k=f-h,y=_?(w=p[h++],x=h<f?p[h++]:0,h<f?p[h++]:0):(w=p.charCodeAt(h++),x=h<f?p.charCodeAt(h++):0,h<f?p.charCodeAt(h++):0),v=w>>2,d=(3&w)<<4|x>>4,m=1<k?(15&x)<<2|y>>6:64,l=2<k?63&y:64,g.push(o.charAt(v)+o.charAt(d)+o.charAt(m)+o.charAt(l));return g.join("")},i.decode=function(p){var w,x,y,v,d,m,l=0,g=0,h="data:";if(p.substr(0,h.length)===h)throw new Error("Invalid base64 input, it looks like a data url.");var f,k=3*(p=p.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(p.charAt(p.length-1)===o.charAt(64)&&k--,p.charAt(p.length-2)===o.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(f=s.uint8array?new Uint8Array(0|k):new Array(0|k);l<p.length;)w=o.indexOf(p.charAt(l++))<<2|(v=o.indexOf(p.charAt(l++)))>>4,x=(15&v)<<4|(d=o.indexOf(p.charAt(l++)))>>2,y=(3&d)<<6|(m=o.indexOf(p.charAt(l++))),f[g++]=w,d!==64&&(f[g++]=x),m!==64&&(f[g++]=y);return f}},{"./support":30,"./utils":32}],2:[function(t,u,i){var r=t("./external"),s=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),p=t("./stream/DataLengthProbe");function w(x,y,v,d,m){this.compressedSize=x,this.uncompressedSize=y,this.crc32=v,this.compression=d,this.compressedContent=m}w.prototype={getContentWorker:function(){var x=new s(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new p("data_length")),y=this;return x.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new s(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},w.createWorkerFrom=function(x,y,v){return x.pipe(new o).pipe(new p("uncompressedSize")).pipe(y.compressWorker(v)).pipe(new p("compressedSize")).withStreamInfo("compression",y)},u.exports=w},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,u,i){var r=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,u,i){var r=t("./utils"),s=function(){for(var o,p=[],w=0;w<256;w++){o=w;for(var x=0;x<8;x++)o=1&o?3988292384^o>>>1:o>>>1;p[w]=o}return p}();u.exports=function(o,p){return o!==void 0&&o.length?r.getTypeOf(o)!=="string"?function(w,x,y,v){var d=s,m=v+y;w^=-1;for(var l=v;l<m;l++)w=w>>>8^d[255&(w^x[l])];return-1^w}(0|p,o,o.length,0):function(w,x,y,v){var d=s,m=v+y;w^=-1;for(var l=v;l<m;l++)w=w>>>8^d[255&(w^x.charCodeAt(l))];return-1^w}(0|p,o,o.length,0):0}},{"./utils":32}],5:[function(t,u,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,u,i){var r=null;r=typeof Promise<"u"?Promise:t("lie"),u.exports={Promise:r}},{lie:37}],7:[function(t,u,i){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=t("pako"),o=t("./utils"),p=t("./stream/GenericWorker"),w=r?"uint8array":"array";function x(y,v){p.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=v,this.meta={}}i.magic="\b\0",o.inherits(x,p),x.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(w,y.data),!1)},x.prototype.flush=function(){p.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){p.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(v){y.push({data:v,meta:y.meta})}},i.compressWorker=function(y){return new x("Deflate",y)},i.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,u,i){function r(d,m){var l,g="";for(l=0;l<m;l++)g+=String.fromCharCode(255&d),d>>>=8;return g}function s(d,m,l,g,h,f){var k,_,C=d.file,A=d.compression,N=f!==w.utf8encode,F=o.transformTo("string",f(C.name)),$=o.transformTo("string",w.utf8encode(C.name)),U=C.comment,Y=o.transformTo("string",f(U)),E=o.transformTo("string",w.utf8encode(U)),T=$.length!==C.name.length,a=E.length!==U.length,L="",tt="",q="",nt=C.dir,W=C.date,et={crc32:0,compressedSize:0,uncompressedSize:0};m&&!l||(et.crc32=d.crc32,et.compressedSize=d.compressedSize,et.uncompressedSize=d.uncompressedSize);var O=0;m&&(O|=8),N||!T&&!a||(O|=2048);var z=0,Q=0;nt&&(z|=16),h==="UNIX"?(Q=798,z|=function(G,dt){var bt=G;return G||(bt=dt?16893:33204),(65535&bt)<<16}(C.unixPermissions,nt)):(Q=20,z|=function(G){return 63&(G||0)}(C.dosPermissions)),k=W.getUTCHours(),k<<=6,k|=W.getUTCMinutes(),k<<=5,k|=W.getUTCSeconds()/2,_=W.getUTCFullYear()-1980,_<<=4,_|=W.getUTCMonth()+1,_<<=5,_|=W.getUTCDate(),T&&(tt=r(1,1)+r(x(F),4)+$,L+="up"+r(tt.length,2)+tt),a&&(q=r(1,1)+r(x(Y),4)+E,L+="uc"+r(q.length,2)+q);var V="";return V+=`
|
|
16
|
-
\0`,V+=r(O,2),V+=A.magic,V+=r(k,2),V+=r(_,2),V+=r(et.crc32,4),V+=r(et.compressedSize,4),V+=r(et.uncompressedSize,4),V+=r(F.length,2),V+=r(L.length,2),{fileRecord:y.LOCAL_FILE_HEADER+V+F+L,dirRecord:y.CENTRAL_FILE_HEADER+r(Q,2)+V+r(Y.length,2)+"\0\0\0\0"+r(z,4)+r(g,4)+F+L+Y}}var o=t("../utils"),p=t("../stream/GenericWorker"),w=t("../utf8"),x=t("../crc32"),y=t("../signature");function v(d,m,l,g){p.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=l,this.encodeFileName=g,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(v,p),v.prototype.push=function(d){var m=d.meta.percent||0,l=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,p.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:l?(m+100*(l-g-1))/l:100}}))},v.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var m=this.streamFiles&&!d.file.dir;if(m){var l=s(d,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:l.fileRecord,meta:{percent:0}})}else this.accumulate=!0},v.prototype.closedSource=function(d){this.accumulate=!1;var m=this.streamFiles&&!d.file.dir,l=s(d,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(l.dirRecord),m)this.push({data:function(g){return y.DATA_DESCRIPTOR+r(g.crc32,4)+r(g.compressedSize,4)+r(g.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:l.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},v.prototype.flush=function(){for(var d=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var l=this.bytesWritten-d,g=function(h,f,k,_,C){var A=o.transformTo("string",C(_));return y.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(h,2)+r(h,2)+r(f,4)+r(k,4)+r(A.length,2)+A}(this.dirRecords.length,l,d,this.zipComment,this.encodeFileName);this.push({data:g,meta:{percent:100}})},v.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},v.prototype.registerPrevious=function(d){this._sources.push(d);var m=this;return d.on("data",function(l){m.processChunk(l)}),d.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),d.on("error",function(l){m.error(l)}),this},v.prototype.resume=function(){return!!p.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},v.prototype.error=function(d){var m=this._sources;if(!p.prototype.error.call(this,d))return!1;for(var l=0;l<m.length;l++)try{m[l].error(d)}catch{}return!0},v.prototype.lock=function(){p.prototype.lock.call(this);for(var d=this._sources,m=0;m<d.length;m++)d[m].lock()},u.exports=v},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,u,i){var r=t("../compressions"),s=t("./ZipFileWorker");i.generateWorker=function(o,p,w){var x=new s(p.streamFiles,w,p.platform,p.encodeFileName),y=0;try{o.forEach(function(v,d){y++;var m=function(f,k){var _=f||k,C=r[_];if(!C)throw new Error(_+" is not a valid compression method !");return C}(d.options.compression,p.compression),l=d.options.compressionOptions||p.compressionOptions||{},g=d.dir,h=d.date;d._compressWorker(m,l).withStreamInfo("file",{name:v,dir:g,date:h,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(x)}),x.entriesCount=y}catch(v){x.error(v)}return x}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,u,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new r;for(var o in this)typeof this[o]!="function"&&(s[o]=this[o]);return s}}(r.prototype=t("./object")).loadAsync=t("./load"),r.support=t("./support"),r.defaults=t("./defaults"),r.version="3.10.2",r.loadAsync=function(s,o){return new r().loadAsync(s,o)},r.external=t("./external"),u.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,u,i){var r=t("./utils"),s=t("./external"),o=t("./utf8"),p=t("./zipEntries"),w=t("./stream/Crc32Probe"),x=t("./nodejsUtils");function y(v){return new s.Promise(function(d,m){var l=v.decompressed.getContentWorker().pipe(new w);l.on("error",function(g){m(g)}).on("end",function(){l.streamInfo.crc32!==v.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}u.exports=function(v,d){var m=this;return d=r.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),x.isNode&&x.isStream(v)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",v,!0,d.optimizedBinaryString,d.base64).then(function(l){var g=new p(d);return g.load(l),g}).then(function(l){var g=[s.Promise.resolve(l)],h=l.files;if(d.checkCRC32)for(var f=0;f<h.length;f++)g.push(y(h[f]));return s.Promise.all(g)}).then(function(l){for(var g=l.shift(),h=g.files,f=0;f<h.length;f++){var k=h[f],_=k.fileNameStr,C=r.resolve(k.fileNameStr);m.file(C,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:d.createFolders}),k.dir||(m.file(C).unsafeOriginalName=_)}return g.zipComment.length&&(m.comment=g.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,u,i){var r=t("../utils"),s=t("../stream/GenericWorker");function o(p,w){s.call(this,"Nodejs stream input adapter for "+p),this._upstreamEnded=!1,this._bindStream(w)}r.inherits(o,s),o.prototype._bindStream=function(p){var w=this;(this._stream=p).pause(),p.on("data",function(x){w.push({data:x,meta:{percent:0}})}).on("error",function(x){w.isPaused?this.generatedError=x:w.error(x)}).on("end",function(){w.isPaused?w._upstreamEnded=!0:w.end()})},o.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},u.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,u,i){var r=t("readable-stream").Readable;function s(o,p,w){r.call(this,p),this._helper=o;var x=this;o.on("data",function(y,v){x.push(y)||x._helper.pause(),w&&w(v)}).on("error",function(y){x.emit("error",y)}).on("end",function(){x.push(null)})}t("../utils").inherits(s,r),s.prototype._read=function(){this._helper.resume()},u.exports=s},{"../utils":32,"readable-stream":16}],14:[function(t,u,i){u.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,s);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,s)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var s=new Buffer(r);return s.fill(0),s},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(t,u,i){function r(C,A,N){var F,$=o.getTypeOf(A),U=o.extend(N||{},x);U.date=U.date||new Date,U.compression!==null&&(U.compression=U.compression.toUpperCase()),typeof U.unixPermissions=="string"&&(U.unixPermissions=parseInt(U.unixPermissions,8)),U.unixPermissions&&16384&U.unixPermissions&&(U.dir=!0),U.dosPermissions&&16&U.dosPermissions&&(U.dir=!0),U.dir&&(C=h(C)),U.createFolders&&(F=g(C))&&f.call(this,F,!0);var Y=$==="string"&&U.binary===!1&&U.base64===!1;N&&N.binary!==void 0||(U.binary=!Y),(A instanceof y&&A.uncompressedSize===0||U.dir||!A||A.length===0)&&(U.base64=!1,U.binary=!0,A="",U.compression="STORE",$="string");var E=null;E=A instanceof y||A instanceof p?A:m.isNode&&m.isStream(A)?new l(C,A):o.prepareContent(C,A,U.binary,U.optimizedBinaryString,U.base64);var T=new v(C,E,U);this.files[C]=T}var s=t("./utf8"),o=t("./utils"),p=t("./stream/GenericWorker"),w=t("./stream/StreamHelper"),x=t("./defaults"),y=t("./compressedObject"),v=t("./zipObject"),d=t("./generate"),m=t("./nodejsUtils"),l=t("./nodejs/NodejsStreamInputAdapter"),g=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var A=C.lastIndexOf("/");return 0<A?C.substring(0,A):""},h=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},f=function(C,A){return A=A!==void 0?A:x.createFolders,C=h(C),this.files[C]||r.call(this,C,null,{dir:!0,createFolders:A}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var A,N,F;for(A in this.files)F=this.files[A],(N=A.slice(this.root.length,A.length))&&A.slice(0,this.root.length)===this.root&&C(N,F)},filter:function(C){var A=[];return this.forEach(function(N,F){C(N,F)&&A.push(F)}),A},file:function(C,A,N){if(arguments.length!==1)return C=this.root+C,r.call(this,C,A,N),this;if(k(C)){var F=C;return this.filter(function(U,Y){return!Y.dir&&F.test(U)})}var $=this.files[this.root+C];return $&&!$.dir?$:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function($,U){return U.dir&&C.test($)});var A=this.root+C,N=f.call(this,A),F=this.clone();return F.root=N.name,F},remove:function(C){C=this.root+C;var A=this.files[C];if(A||(C.slice(-1)!=="/"&&(C+="/"),A=this.files[C]),A&&!A.dir)delete this.files[C];else for(var N=this.filter(function($,U){return U.name.slice(0,C.length)===C}),F=0;F<N.length;F++)delete this.files[N[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var A,N={};try{if((N=o.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");o.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var F=N.comment||this.comment||"";A=d.generateWorker(this,N,F)}catch($){(A=new p("error")).error($)}return new w(A,N.type||"string",N.mimeType)},generateAsync:function(C,A){return this.generateInternalStream(C).accumulate(A)},generateNodeStream:function(C,A){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(A)}};u.exports=_},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,u,i){u.exports=t("stream")},{stream:void 0}],17:[function(t,u,i){var r=t("./DataReader");function s(o){r.call(this,o);for(var p=0;p<this.data.length;p++)o[p]=255&o[p]}t("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data[this.zero+o]},s.prototype.lastIndexOfSignature=function(o){for(var p=o.charCodeAt(0),w=o.charCodeAt(1),x=o.charCodeAt(2),y=o.charCodeAt(3),v=this.length-4;0<=v;--v)if(this.data[v]===p&&this.data[v+1]===w&&this.data[v+2]===x&&this.data[v+3]===y)return v-this.zero;return-1},s.prototype.readAndCheckSignature=function(o){var p=o.charCodeAt(0),w=o.charCodeAt(1),x=o.charCodeAt(2),y=o.charCodeAt(3),v=this.readData(4);return p===v[0]&&w===v[1]&&x===v[2]&&y===v[3]},s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var p=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,p},u.exports=s},{"../utils":32,"./DataReader":18}],18:[function(t,u,i){var r=t("../utils");function s(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var p,w=0;for(this.checkOffset(o),p=this.index+o-1;p>=this.index;p--)w=(w<<8)+this.byteAt(p);return this.index+=o,w},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},u.exports=s},{"../utils":32}],19:[function(t,u,i){var r=t("./Uint8ArrayReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.readData=function(o){this.checkOffset(o);var p=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,p},u.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,u,i){var r=t("./DataReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},s.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},s.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},s.prototype.readData=function(o){this.checkOffset(o);var p=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,p},u.exports=s},{"../utils":32,"./DataReader":18}],21:[function(t,u,i){var r=t("./ArrayReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var p=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,p},u.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(t,u,i){var r=t("../utils"),s=t("../support"),o=t("./ArrayReader"),p=t("./StringReader"),w=t("./NodeBufferReader"),x=t("./Uint8ArrayReader");u.exports=function(y){var v=r.getTypeOf(y);return r.checkSupport(v),v!=="string"||s.uint8array?v==="nodebuffer"?new w(y):s.uint8array?new x(r.transformTo("uint8array",y)):new o(r.transformTo("array",y)):new p(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,u,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,u,i){var r=t("./GenericWorker"),s=t("../utils");function o(p){r.call(this,"ConvertWorker to "+p),this.destType=p}s.inherits(o,r),o.prototype.processChunk=function(p){this.push({data:s.transformTo(this.destType,p.data),meta:p.meta})},u.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,u,i){var r=t("./GenericWorker"),s=t("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,r),o.prototype.processChunk=function(p){this.streamInfo.crc32=s(p.data,this.streamInfo.crc32||0),this.push(p)},u.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,u,i){var r=t("../utils"),s=t("./GenericWorker");function o(p){s.call(this,"DataLengthProbe for "+p),this.propName=p,this.withStreamInfo(p,0)}r.inherits(o,s),o.prototype.processChunk=function(p){if(p){var w=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=w+p.data.length}s.prototype.processChunk.call(this,p)},u.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,u,i){var r=t("../utils"),s=t("./GenericWorker");function o(p){s.call(this,"DataWorker");var w=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,p.then(function(x){w.dataIsReady=!0,w.data=x,w.max=x&&x.length||0,w.type=r.getTypeOf(x),w.isPaused||w._tickAndRepeat()},function(x){w.error(x)})}r.inherits(o,s),o.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var p=null,w=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":p=this.data.substring(this.index,w);break;case"uint8array":p=this.data.subarray(this.index,w);break;case"array":case"nodebuffer":p=this.data.slice(this.index,w)}return this.index=w,this.push({data:p,meta:{percent:this.max?this.index/this.max*100:0}})},u.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,u,i){function r(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,o){return this._listeners[s].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,o){if(this._listeners[s])for(var p=0;p<this._listeners[s].length;p++)this._listeners[s][p].call(this,o)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var o=this;return s.on("data",function(p){o.processChunk(p)}),s.on("end",function(){o.end()}),s.on("error",function(p){o.error(p)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,o){return this.extraStreamInfo[s]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},u.exports=r},{}],29:[function(t,u,i){var r=t("../utils"),s=t("./ConvertWorker"),o=t("./GenericWorker"),p=t("../base64"),w=t("../support"),x=t("../external"),y=null;if(w.nodestream)try{y=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function v(m,l){return new x.Promise(function(g,h){var f=[],k=m._internalType,_=m._outputType,C=m._mimeType;m.on("data",function(A,N){f.push(A),l&&l(N)}).on("error",function(A){f=[],h(A)}).on("end",function(){try{var A=function(N,F,$){switch(N){case"blob":return r.newBlob(r.transformTo("arraybuffer",F),$);case"base64":return p.encode(F);default:return r.transformTo(N,F)}}(_,function(N,F){var $,U=0,Y=null,E=0;for($=0;$<F.length;$++)E+=F[$].length;switch(N){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(Y=new Uint8Array(E),$=0;$<F.length;$++)Y.set(F[$],U),U+=F[$].length;return Y;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+N+"'")}}(k,f),C);g(A)}catch(N){h(N)}f=[]}).resume()})}function d(m,l,g){var h=l;switch(l){case"blob":case"arraybuffer":h="uint8array";break;case"base64":h="string"}try{this._internalType=h,this._outputType=l,this._mimeType=g,r.checkSupport(h),this._worker=m.pipe(new s(h)),m.lock()}catch(f){this._worker=new o("error"),this._worker.error(f)}}d.prototype={accumulate:function(m){return v(this,m)},on:function(m,l){var g=this;return m==="data"?this._worker.on(m,function(h){l.call(g,h.data,h.meta)}):this._worker.on(m,function(){r.delay(l,arguments,g)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new y(this,{objectMode:this._outputType!=="nodebuffer"},m)}},u.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,u,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(r),i.blob=s.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,u,i){for(var r=t("./utils"),s=t("./support"),o=t("./nodejsUtils"),p=t("./stream/GenericWorker"),w=new Array(256),x=0;x<256;x++)w[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;w[254]=w[254]=1;function y(){p.call(this,"utf-8 decode"),this.leftOver=null}function v(){p.call(this,"utf-8 encode")}i.utf8encode=function(d){return s.nodebuffer?o.newBufferFrom(d,"utf-8"):function(m){var l,g,h,f,k,_=m.length,C=0;for(f=0;f<_;f++)(64512&(g=m.charCodeAt(f)))==55296&&f+1<_&&(64512&(h=m.charCodeAt(f+1)))==56320&&(g=65536+(g-55296<<10)+(h-56320),f++),C+=g<128?1:g<2048?2:g<65536?3:4;for(l=s.uint8array?new Uint8Array(C):new Array(C),f=k=0;k<C;f++)(64512&(g=m.charCodeAt(f)))==55296&&f+1<_&&(64512&(h=m.charCodeAt(f+1)))==56320&&(g=65536+(g-55296<<10)+(h-56320),f++),g<128?l[k++]=g:(g<2048?l[k++]=192|g>>>6:(g<65536?l[k++]=224|g>>>12:(l[k++]=240|g>>>18,l[k++]=128|g>>>12&63),l[k++]=128|g>>>6&63),l[k++]=128|63&g);return l}(d)},i.utf8decode=function(d){return s.nodebuffer?r.transformTo("nodebuffer",d).toString("utf-8"):function(m){var l,g,h,f,k=m.length,_=new Array(2*k);for(l=g=0;l<k;)if((h=m[l++])<128)_[g++]=h;else if(4<(f=w[h]))_[g++]=65533,l+=f-1;else{for(h&=f===2?31:f===3?15:7;1<f&&l<k;)h=h<<6|63&m[l++],f--;1<f?_[g++]=65533:h<65536?_[g++]=h:(h-=65536,_[g++]=55296|h>>10&1023,_[g++]=56320|1023&h)}return _.length!==g&&(_.subarray?_=_.subarray(0,g):_.length=g),r.applyFromCharCode(_)}(d=r.transformTo(s.uint8array?"uint8array":"array",d))},r.inherits(y,p),y.prototype.processChunk=function(d){var m=r.transformTo(s.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var l=m;(m=new Uint8Array(l.length+this.leftOver.length)).set(this.leftOver,0),m.set(l,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var g=function(f,k){var _;for((k=k||f.length)>f.length&&(k=f.length),_=k-1;0<=_&&(192&f[_])==128;)_--;return _<0||_===0?k:_+w[f[_]]>k?_:k}(m),h=m;g!==m.length&&(s.uint8array?(h=m.subarray(0,g),this.leftOver=m.subarray(g,m.length)):(h=m.slice(0,g),this.leftOver=m.slice(g,m.length))),this.push({data:i.utf8decode(h),meta:d.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=y,r.inherits(v,p),v.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=v},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,u,i){var r=t("./support"),s=t("./base64"),o=t("./nodejsUtils"),p=t("./external");function w(l){return l}function x(l,g){for(var h=0;h<l.length;++h)g[h]=255&l.charCodeAt(h);return g}t("setimmediate"),i.newBlob=function(l,g){i.checkSupport("blob");try{return new Blob([l],{type:g})}catch{try{var h=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return h.append(l),h.getBlob(g)}catch{throw new Error("Bug : can't construct the Blob.")}}};var y={stringifyByChunk:function(l,g,h){var f=[],k=0,_=l.length;if(_<=h)return String.fromCharCode.apply(null,l);for(;k<_;)g==="array"||g==="nodebuffer"?f.push(String.fromCharCode.apply(null,l.slice(k,Math.min(k+h,_)))):f.push(String.fromCharCode.apply(null,l.subarray(k,Math.min(k+h,_)))),k+=h;return f.join("")},stringifyByChar:function(l){for(var g="",h=0;h<l.length;h++)g+=String.fromCharCode(l[h]);return g},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}}()}};function v(l){var g=65536,h=i.getTypeOf(l),f=!0;if(h==="uint8array"?f=y.applyCanBeUsed.uint8array:h==="nodebuffer"&&(f=y.applyCanBeUsed.nodebuffer),f)for(;1<g;)try{return y.stringifyByChunk(l,h,g)}catch{g=Math.floor(g/2)}return y.stringifyByChar(l)}function d(l,g){for(var h=0;h<l.length;h++)g[h]=l[h];return g}i.applyFromCharCode=v;var m={};m.string={string:w,array:function(l){return x(l,new Array(l.length))},arraybuffer:function(l){return m.string.uint8array(l).buffer},uint8array:function(l){return x(l,new Uint8Array(l.length))},nodebuffer:function(l){return x(l,o.allocBuffer(l.length))}},m.array={string:v,array:w,arraybuffer:function(l){return new Uint8Array(l).buffer},uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(l)}},m.arraybuffer={string:function(l){return v(new Uint8Array(l))},array:function(l){return d(new Uint8Array(l),new Array(l.byteLength))},arraybuffer:w,uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(new Uint8Array(l))}},m.uint8array={string:v,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return l.buffer},uint8array:w,nodebuffer:function(l){return o.newBufferFrom(l)}},m.nodebuffer={string:v,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return m.nodebuffer.uint8array(l).buffer},uint8array:function(l){return d(l,new Uint8Array(l.length))},nodebuffer:w},i.transformTo=function(l,g){if(g=g||"",!l)return g;i.checkSupport(l);var h=i.getTypeOf(g);return m[h][l](g)},i.resolve=function(l){for(var g=l.split("/"),h=[],f=0;f<g.length;f++){var k=g[f];k==="."||k===""&&f!==0&&f!==g.length-1||(k===".."?h.pop():h.push(k))}return h.join("/")},i.getTypeOf=function(l){if(typeof l=="string")return"string";var g=Object.prototype.toString.call(l);return g==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(l)?"nodebuffer":r.uint8array&&g==="[object Uint8Array]"?"uint8array":r.arraybuffer&&g==="[object ArrayBuffer]"?"arraybuffer":void 0},i.checkSupport=function(l){if(!r[l.toLowerCase()])throw new Error(l+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(l){var g,h,f="";for(h=0;h<(l||"").length;h++)f+="\\x"+((g=l.charCodeAt(h))<16?"0":"")+g.toString(16).toUpperCase();return f},i.delay=function(l,g,h){setImmediate(function(){l.apply(h||null,g||[])})},i.inherits=function(l,g){function h(){}h.prototype=g.prototype,l.prototype=new h},i.extend=function(){var l,g,h={};for(l=0;l<arguments.length;l++)for(g in arguments[l])Object.prototype.hasOwnProperty.call(arguments[l],g)&&h[g]===void 0&&(h[g]=arguments[l][g]);return h},i.prepareContent=function(l,g,h,f,k){return p.Promise.resolve(g).then(function(_){return r.blob&&(_ instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(_))!==-1)?Blob.prototype.arrayBuffer!==void 0?_.arrayBuffer():typeof FileReader<"u"?new p.Promise(function(C,A){var N=new FileReader;N.onload=function(F){C(F.target.result)},N.onerror=function(F){A(F.target.error)},N.readAsArrayBuffer(_)}):p.Promise.reject(new Error(l+" is a Blob, but we have no way of reading it.")):_}).then(function(_){var C=i.getTypeOf(_);return C?(C==="arraybuffer"?_=i.transformTo("uint8array",_):C==="string"&&(k?_=s.decode(_):h&&f!==!0&&(_=function(A){return x(A,r.uint8array?new Uint8Array(A.length):new Array(A.length))}(_))),_):p.Promise.reject(new Error("Can't read the data of '"+l+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,u,i){var r=t("./reader/readerFor"),s=t("./utils"),o=t("./signature"),p=t("./zipEntry"),w=t("./support");function x(y){this.files=[],this.loadOptions=y}x.prototype={checkSignature:function(y){if(!this.reader.readAndCheckSignature(y)){this.reader.index-=4;var v=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(v)+", expected "+s.pretty(y)+")")}},isSignature:function(y,v){var d=this.reader.index;this.reader.setIndex(y);var m=this.reader.readString(4)===v;return this.reader.setIndex(d),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var y=this.reader.readData(this.zipCommentLength),v=w.uint8array?"uint8array":"array",d=s.transformTo(v,y);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var y,v,d,m=this.zip64EndOfCentralSize-44;0<m;)y=this.reader.readInt(2),v=this.reader.readInt(4),d=this.reader.readData(v),this.zip64ExtensibleData[y]={id:y,length:v,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var y,v;for(y=0;y<this.files.length;y++)v=this.files[y],this.reader.setIndex(v.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),v.readLocalPart(this.reader),v.handleUTF8(),v.processAttributes()},readCentralDir:function(){var y;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(y=new p({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(y);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var y=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(y<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(y);var v=y;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(y=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(y),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var m=v-d;if(0<m)this.isSignature(v,o.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(y){this.reader=r(y)},load:function(y){this.prepareReader(y),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},u.exports=x},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,u,i){var r=t("./reader/readerFor"),s=t("./utils"),o=t("./compressedObject"),p=t("./crc32"),w=t("./utf8"),x=t("./compressions"),y=t("./support");function v(d,m){this.options=d,this.loadOptions=m}v.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var m,l;if(d.skip(22),this.fileNameLength=d.readInt(2),l=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(l),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=function(g){for(var h in x)if(Object.prototype.hasOwnProperty.call(x,h)&&x[h].magic===g)return x[h];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,m,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var m=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(m),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=r(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var m,l,g,h=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<h;)m=d.readInt(2),l=d.readInt(2),g=d.readData(l),this.extraFields[m]={id:m,length:l,value:g};d.setIndex(h)},handleUTF8:function(){var d=y.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=w.utf8decode(this.fileName),this.fileCommentStr=w.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var l=s.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(l)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var h=s.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(h)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var m=r(d.value);return m.readInt(1)!==1||p(this.fileName)!==m.readInt(4)?null:w.utf8decode(m.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var m=r(d.value);return m.readInt(1)!==1||p(this.fileComment)!==m.readInt(4)?null:w.utf8decode(m.readData(d.length-5))}return null}},u.exports=v},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,u,i){function r(m,l,g){this.name=m,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=l,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var s=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),p=t("./utf8"),w=t("./compressedObject"),x=t("./stream/GenericWorker");r.prototype={internalStream:function(m){var l=null,g="string";try{if(!m)throw new Error("No output type specified.");var h=(g=m.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),l=this._decompressWorker();var f=!this._dataBinary;f&&!h&&(l=l.pipe(new p.Utf8EncodeWorker)),!f&&h&&(l=l.pipe(new p.Utf8DecodeWorker))}catch(k){(l=new x("error")).error(k)}return new s(l,g,"")},async:function(m,l){return this.internalStream(m).accumulate(l)},nodeStream:function(m,l){return this.internalStream(m||"nodebuffer").toNodejsStream(l)},_compressWorker:function(m,l){if(this._data instanceof w&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new p.Utf8EncodeWorker)),w.createWorkerFrom(g,m,l)},_decompressWorker:function(){return this._data instanceof w?this._data.getContentWorker():this._data instanceof x?this._data:new o(this._data)}};for(var y=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],v=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<y.length;d++)r.prototype[y[d]]=v;u.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,u,i){(function(r){var s,o,p=r.MutationObserver||r.WebKitMutationObserver;if(p){var w=0,x=new p(m),y=r.document.createTextNode("");x.observe(y,{characterData:!0}),s=function(){y.data=w=++w%2}}else if(r.setImmediate||r.MessageChannel===void 0)s="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var l=r.document.createElement("script");l.onreadystatechange=function(){m(),l.onreadystatechange=null,l.parentNode.removeChild(l),l=null},r.document.documentElement.appendChild(l)}:function(){setTimeout(m,0)};else{var v=new r.MessageChannel;v.port1.onmessage=m,s=function(){v.port2.postMessage(0)}}var d=[];function m(){var l,g;o=!0;for(var h=d.length;h;){for(g=d,d=[],l=-1;++l<h;)g[l]();h=d.length}o=!1}u.exports=function(l){d.push(l)!==1||o||s()}}).call(this,typeof ie<"u"?ie:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,u,i){var r=t("immediate");function s(){}var o={},p=["REJECTED"],w=["FULFILLED"],x=["PENDING"];function y(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=x,this.queue=[],this.outcome=void 0,h!==s&&l(this,h)}function v(h,f,k){this.promise=h,typeof f=="function"&&(this.onFulfilled=f,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function d(h,f,k){r(function(){var _;try{_=f(k)}catch(C){return o.reject(h,C)}_===h?o.reject(h,new TypeError("Cannot resolve promise with itself")):o.resolve(h,_)})}function m(h){var f=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof f=="function")return function(){f.apply(h,arguments)}}function l(h,f){var k=!1;function _(N){k||(k=!0,o.reject(h,N))}function C(N){k||(k=!0,o.resolve(h,N))}var A=g(function(){f(C,_)});A.status==="error"&&_(A.value)}function g(h,f){var k={};try{k.value=h(f),k.status="success"}catch(_){k.status="error",k.value=_}return k}(u.exports=y).prototype.finally=function(h){if(typeof h!="function")return this;var f=this.constructor;return this.then(function(k){return f.resolve(h()).then(function(){return k})},function(k){return f.resolve(h()).then(function(){throw k})})},y.prototype.catch=function(h){return this.then(null,h)},y.prototype.then=function(h,f){if(typeof h!="function"&&this.state===w||typeof f!="function"&&this.state===p)return this;var k=new this.constructor(s);return this.state!==x?d(k,this.state===w?h:f,this.outcome):this.queue.push(new v(k,h,f)),k},v.prototype.callFulfilled=function(h){o.resolve(this.promise,h)},v.prototype.otherCallFulfilled=function(h){d(this.promise,this.onFulfilled,h)},v.prototype.callRejected=function(h){o.reject(this.promise,h)},v.prototype.otherCallRejected=function(h){d(this.promise,this.onRejected,h)},o.resolve=function(h,f){var k=g(m,f);if(k.status==="error")return o.reject(h,k.value);var _=k.value;if(_)l(h,_);else{h.state=w,h.outcome=f;for(var C=-1,A=h.queue.length;++C<A;)h.queue[C].callFulfilled(f)}return h},o.reject=function(h,f){h.state=p,h.outcome=f;for(var k=-1,_=h.queue.length;++k<_;)h.queue[k].callRejected(f);return h},y.resolve=function(h){return h instanceof this?h:o.resolve(new this(s),h)},y.reject=function(h){var f=new this(s);return o.reject(f,h)},y.all=function(h){var f=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=h.length,_=!1;if(!k)return this.resolve([]);for(var C=new Array(k),A=0,N=-1,F=new this(s);++N<k;)$(h[N],N);return F;function $(U,Y){f.resolve(U).then(function(E){C[Y]=E,++A!==k||_||(_=!0,o.resolve(F,C))},function(E){_||(_=!0,o.reject(F,E))})}},y.race=function(h){var f=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=h.length,_=!1;if(!k)return this.resolve([]);for(var C=-1,A=new this(s);++C<k;)N=h[C],f.resolve(N).then(function(F){_||(_=!0,o.resolve(A,F))},function(F){_||(_=!0,o.reject(A,F))});var N;return A}},{immediate:36}],38:[function(t,u,i){var r={};(0,t("./lib/utils/common").assign)(r,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),u.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,u,i){var r=t("./zlib/deflate"),s=t("./utils/common"),o=t("./utils/strings"),p=t("./zlib/messages"),w=t("./zlib/zstream"),x=Object.prototype.toString,y=0,v=-1,d=0,m=8;function l(h){if(!(this instanceof l))return new l(h);this.options=s.assign({level:v,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},h||{});var f=this.options;f.raw&&0<f.windowBits?f.windowBits=-f.windowBits:f.gzip&&0<f.windowBits&&f.windowBits<16&&(f.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new w,this.strm.avail_out=0;var k=r.deflateInit2(this.strm,f.level,f.method,f.windowBits,f.memLevel,f.strategy);if(k!==y)throw new Error(p[k]);if(f.header&&r.deflateSetHeader(this.strm,f.header),f.dictionary){var _;if(_=typeof f.dictionary=="string"?o.string2buf(f.dictionary):x.call(f.dictionary)==="[object ArrayBuffer]"?new Uint8Array(f.dictionary):f.dictionary,(k=r.deflateSetDictionary(this.strm,_))!==y)throw new Error(p[k]);this._dict_set=!0}}function g(h,f){var k=new l(f);if(k.push(h,!0),k.err)throw k.msg||p[k.err];return k.result}l.prototype.push=function(h,f){var k,_,C=this.strm,A=this.options.chunkSize;if(this.ended)return!1;_=f===~~f?f:f===!0?4:0,typeof h=="string"?C.input=o.string2buf(h):x.call(h)==="[object ArrayBuffer]"?C.input=new Uint8Array(h):C.input=h,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new s.Buf8(A),C.next_out=0,C.avail_out=A),(k=r.deflate(C,_))!==1&&k!==y)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||_!==4&&_!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(s.shrinkBuf(C.output,C.next_out))):this.onData(s.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return _===4?(k=r.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===y):_!==2||(this.onEnd(y),!(C.avail_out=0))},l.prototype.onData=function(h){this.chunks.push(h)},l.prototype.onEnd=function(h){h===y&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=h,this.msg=this.strm.msg},i.Deflate=l,i.deflate=g,i.deflateRaw=function(h,f){return(f=f||{}).raw=!0,g(h,f)},i.gzip=function(h,f){return(f=f||{}).gzip=!0,g(h,f)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,u,i){var r=t("./zlib/inflate"),s=t("./utils/common"),o=t("./utils/strings"),p=t("./zlib/constants"),w=t("./zlib/messages"),x=t("./zlib/zstream"),y=t("./zlib/gzheader"),v=Object.prototype.toString;function d(l){if(!(this instanceof d))return new d(l);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},l||{});var g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||l&&l.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&!(15&g.windowBits)&&(g.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new x,this.strm.avail_out=0;var h=r.inflateInit2(this.strm,g.windowBits);if(h!==p.Z_OK)throw new Error(w[h]);this.header=new y,r.inflateGetHeader(this.strm,this.header)}function m(l,g){var h=new d(g);if(h.push(l,!0),h.err)throw h.msg||w[h.err];return h.result}d.prototype.push=function(l,g){var h,f,k,_,C,A,N=this.strm,F=this.options.chunkSize,$=this.options.dictionary,U=!1;if(this.ended)return!1;f=g===~~g?g:g===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof l=="string"?N.input=o.binstring2buf(l):v.call(l)==="[object ArrayBuffer]"?N.input=new Uint8Array(l):N.input=l,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new s.Buf8(F),N.next_out=0,N.avail_out=F),(h=r.inflate(N,p.Z_NO_FLUSH))===p.Z_NEED_DICT&&$&&(A=typeof $=="string"?o.string2buf($):v.call($)==="[object ArrayBuffer]"?new Uint8Array($):$,h=r.inflateSetDictionary(this.strm,A)),h===p.Z_BUF_ERROR&&U===!0&&(h=p.Z_OK,U=!1),h!==p.Z_STREAM_END&&h!==p.Z_OK)return this.onEnd(h),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&h!==p.Z_STREAM_END&&(N.avail_in!==0||f!==p.Z_FINISH&&f!==p.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=o.utf8border(N.output,N.next_out),_=N.next_out-k,C=o.buf2string(N.output,k),N.next_out=_,N.avail_out=F-_,_&&s.arraySet(N.output,N.output,k,_,0),this.onData(C)):this.onData(s.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(U=!0)}while((0<N.avail_in||N.avail_out===0)&&h!==p.Z_STREAM_END);return h===p.Z_STREAM_END&&(f=p.Z_FINISH),f===p.Z_FINISH?(h=r.inflateEnd(this.strm),this.onEnd(h),this.ended=!0,h===p.Z_OK):f!==p.Z_SYNC_FLUSH||(this.onEnd(p.Z_OK),!(N.avail_out=0))},d.prototype.onData=function(l){this.chunks.push(l)},d.prototype.onEnd=function(l){l===p.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},i.Inflate=d,i.inflate=m,i.inflateRaw=function(l,g){return(g=g||{}).raw=!0,m(l,g)},i.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,u,i){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(p){for(var w=Array.prototype.slice.call(arguments,1);w.length;){var x=w.shift();if(x){if(typeof x!="object")throw new TypeError(x+"must be non-object");for(var y in x)x.hasOwnProperty(y)&&(p[y]=x[y])}}return p},i.shrinkBuf=function(p,w){return p.length===w?p:p.subarray?p.subarray(0,w):(p.length=w,p)};var s={arraySet:function(p,w,x,y,v){if(w.subarray&&p.subarray)p.set(w.subarray(x,x+y),v);else for(var d=0;d<y;d++)p[v+d]=w[x+d]},flattenChunks:function(p){var w,x,y,v,d,m;for(w=y=0,x=p.length;w<x;w++)y+=p[w].length;for(m=new Uint8Array(y),w=v=0,x=p.length;w<x;w++)d=p[w],m.set(d,v),v+=d.length;return m}},o={arraySet:function(p,w,x,y,v){for(var d=0;d<y;d++)p[v+d]=w[x+d]},flattenChunks:function(p){return[].concat.apply([],p)}};i.setTyped=function(p){p?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,s)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(r)},{}],42:[function(t,u,i){var r=t("./common"),s=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var p=new r.Buf8(256),w=0;w<256;w++)p[w]=252<=w?6:248<=w?5:240<=w?4:224<=w?3:192<=w?2:1;function x(y,v){if(v<65537&&(y.subarray&&o||!y.subarray&&s))return String.fromCharCode.apply(null,r.shrinkBuf(y,v));for(var d="",m=0;m<v;m++)d+=String.fromCharCode(y[m]);return d}p[254]=p[254]=1,i.string2buf=function(y){var v,d,m,l,g,h=y.length,f=0;for(l=0;l<h;l++)(64512&(d=y.charCodeAt(l)))==55296&&l+1<h&&(64512&(m=y.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(m-56320),l++),f+=d<128?1:d<2048?2:d<65536?3:4;for(v=new r.Buf8(f),l=g=0;g<f;l++)(64512&(d=y.charCodeAt(l)))==55296&&l+1<h&&(64512&(m=y.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(m-56320),l++),d<128?v[g++]=d:(d<2048?v[g++]=192|d>>>6:(d<65536?v[g++]=224|d>>>12:(v[g++]=240|d>>>18,v[g++]=128|d>>>12&63),v[g++]=128|d>>>6&63),v[g++]=128|63&d);return v},i.buf2binstring=function(y){return x(y,y.length)},i.binstring2buf=function(y){for(var v=new r.Buf8(y.length),d=0,m=v.length;d<m;d++)v[d]=y.charCodeAt(d);return v},i.buf2string=function(y,v){var d,m,l,g,h=v||y.length,f=new Array(2*h);for(d=m=0;d<h;)if((l=y[d++])<128)f[m++]=l;else if(4<(g=p[l]))f[m++]=65533,d+=g-1;else{for(l&=g===2?31:g===3?15:7;1<g&&d<h;)l=l<<6|63&y[d++],g--;1<g?f[m++]=65533:l<65536?f[m++]=l:(l-=65536,f[m++]=55296|l>>10&1023,f[m++]=56320|1023&l)}return x(f,m)},i.utf8border=function(y,v){var d;for((v=v||y.length)>y.length&&(v=y.length),d=v-1;0<=d&&(192&y[d])==128;)d--;return d<0||d===0?v:d+p[y[d]]>v?d:v}},{"./common":41}],43:[function(t,u,i){u.exports=function(r,s,o,p){for(var w=65535&r|0,x=r>>>16&65535|0,y=0;o!==0;){for(o-=y=2e3<o?2e3:o;x=x+(w=w+s[p++]|0)|0,--y;);w%=65521,x%=65521}return w|x<<16|0}},{}],44:[function(t,u,i){u.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,u,i){var r=function(){for(var s,o=[],p=0;p<256;p++){s=p;for(var w=0;w<8;w++)s=1&s?3988292384^s>>>1:s>>>1;o[p]=s}return o}();u.exports=function(s,o,p,w){var x=r,y=w+p;s^=-1;for(var v=w;v<y;v++)s=s>>>8^x[255&(s^o[v])];return-1^s}},{}],46:[function(t,u,i){var r,s=t("../utils/common"),o=t("./trees"),p=t("./adler32"),w=t("./crc32"),x=t("./messages"),y=0,v=4,d=0,m=-2,l=-1,g=4,h=2,f=8,k=9,_=286,C=30,A=19,N=2*_+1,F=15,$=3,U=258,Y=U+$+1,E=42,T=113,a=1,L=2,tt=3,q=4;function nt(n,j){return n.msg=x[j],j}function W(n){return(n<<1)-(4<n?9:0)}function et(n){for(var j=n.length;0<=--j;)n[j]=0}function O(n){var j=n.state,B=j.pending;B>n.avail_out&&(B=n.avail_out),B!==0&&(s.arraySet(n.output,j.pending_buf,j.pending_out,B,n.next_out),n.next_out+=B,j.pending_out+=B,n.total_out+=B,n.avail_out-=B,j.pending-=B,j.pending===0&&(j.pending_out=0))}function z(n,j){o._tr_flush_block(n,0<=n.block_start?n.block_start:-1,n.strstart-n.block_start,j),n.block_start=n.strstart,O(n.strm)}function Q(n,j){n.pending_buf[n.pending++]=j}function V(n,j){n.pending_buf[n.pending++]=j>>>8&255,n.pending_buf[n.pending++]=255&j}function G(n,j){var B,S,b=n.max_chain_length,I=n.strstart,D=n.prev_length,P=n.nice_match,R=n.strstart>n.w_size-Y?n.strstart-(n.w_size-Y):0,Z=n.window,X=n.w_mask,H=n.prev,J=n.strstart+U,lt=Z[I+D-1],st=Z[I+D];n.prev_length>=n.good_match&&(b>>=2),P>n.lookahead&&(P=n.lookahead);do if(Z[(B=j)+D]===st&&Z[B+D-1]===lt&&Z[B]===Z[I]&&Z[++B]===Z[I+1]){I+=2,B++;do;while(Z[++I]===Z[++B]&&Z[++I]===Z[++B]&&Z[++I]===Z[++B]&&Z[++I]===Z[++B]&&Z[++I]===Z[++B]&&Z[++I]===Z[++B]&&Z[++I]===Z[++B]&&Z[++I]===Z[++B]&&I<J);if(S=U-(J-I),I=J-U,D<S){if(n.match_start=j,P<=(D=S))break;lt=Z[I+D-1],st=Z[I+D]}}while((j=H[j&X])>R&&--b!=0);return D<=n.lookahead?D:n.lookahead}function dt(n){var j,B,S,b,I,D,P,R,Z,X,H=n.w_size;do{if(b=n.window_size-n.lookahead-n.strstart,n.strstart>=H+(H-Y)){for(s.arraySet(n.window,n.window,H,H,0),n.match_start-=H,n.strstart-=H,n.block_start-=H,j=B=n.hash_size;S=n.head[--j],n.head[j]=H<=S?S-H:0,--B;);for(j=B=H;S=n.prev[--j],n.prev[j]=H<=S?S-H:0,--B;);b+=H}if(n.strm.avail_in===0)break;if(D=n.strm,P=n.window,R=n.strstart+n.lookahead,Z=b,X=void 0,X=D.avail_in,Z<X&&(X=Z),B=X===0?0:(D.avail_in-=X,s.arraySet(P,D.input,D.next_in,X,R),D.state.wrap===1?D.adler=p(D.adler,P,X,R):D.state.wrap===2&&(D.adler=w(D.adler,P,X,R)),D.next_in+=X,D.total_in+=X,X),n.lookahead+=B,n.lookahead+n.insert>=$)for(I=n.strstart-n.insert,n.ins_h=n.window[I],n.ins_h=(n.ins_h<<n.hash_shift^n.window[I+1])&n.hash_mask;n.insert&&(n.ins_h=(n.ins_h<<n.hash_shift^n.window[I+$-1])&n.hash_mask,n.prev[I&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=I,I++,n.insert--,!(n.lookahead+n.insert<$)););}while(n.lookahead<Y&&n.strm.avail_in!==0)}function bt(n,j){for(var B,S;;){if(n.lookahead<Y){if(dt(n),n.lookahead<Y&&j===y)return a;if(n.lookahead===0)break}if(B=0,n.lookahead>=$&&(n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+$-1])&n.hash_mask,B=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),B!==0&&n.strstart-B<=n.w_size-Y&&(n.match_length=G(n,B)),n.match_length>=$)if(S=o._tr_tally(n,n.strstart-n.match_start,n.match_length-$),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=$){for(n.match_length--;n.strstart++,n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+$-1])&n.hash_mask,B=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart,--n.match_length!=0;);n.strstart++}else n.strstart+=n.match_length,n.match_length=0,n.ins_h=n.window[n.strstart],n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+1])&n.hash_mask;else S=o._tr_tally(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++;if(S&&(z(n,!1),n.strm.avail_out===0))return a}return n.insert=n.strstart<$-1?n.strstart:$-1,j===v?(z(n,!0),n.strm.avail_out===0?tt:q):n.last_lit&&(z(n,!1),n.strm.avail_out===0)?a:L}function ot(n,j){for(var B,S,b;;){if(n.lookahead<Y){if(dt(n),n.lookahead<Y&&j===y)return a;if(n.lookahead===0)break}if(B=0,n.lookahead>=$&&(n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+$-1])&n.hash_mask,B=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),n.prev_length=n.match_length,n.prev_match=n.match_start,n.match_length=$-1,B!==0&&n.prev_length<n.max_lazy_match&&n.strstart-B<=n.w_size-Y&&(n.match_length=G(n,B),n.match_length<=5&&(n.strategy===1||n.match_length===$&&4096<n.strstart-n.match_start)&&(n.match_length=$-1)),n.prev_length>=$&&n.match_length<=n.prev_length){for(b=n.strstart+n.lookahead-$,S=o._tr_tally(n,n.strstart-1-n.prev_match,n.prev_length-$),n.lookahead-=n.prev_length-1,n.prev_length-=2;++n.strstart<=b&&(n.ins_h=(n.ins_h<<n.hash_shift^n.window[n.strstart+$-1])&n.hash_mask,B=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),--n.prev_length!=0;);if(n.match_available=0,n.match_length=$-1,n.strstart++,S&&(z(n,!1),n.strm.avail_out===0))return a}else if(n.match_available){if((S=o._tr_tally(n,0,n.window[n.strstart-1]))&&z(n,!1),n.strstart++,n.lookahead--,n.strm.avail_out===0)return a}else n.match_available=1,n.strstart++,n.lookahead--}return n.match_available&&(S=o._tr_tally(n,0,n.window[n.strstart-1]),n.match_available=0),n.insert=n.strstart<$-1?n.strstart:$-1,j===v?(z(n,!0),n.strm.avail_out===0?tt:q):n.last_lit&&(z(n,!1),n.strm.avail_out===0)?a:L}function at(n,j,B,S,b){this.good_length=n,this.max_lazy=j,this.nice_length=B,this.max_chain=S,this.func=b}function yt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=f,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*N),this.dyn_dtree=new s.Buf16(2*(2*C+1)),this.bl_tree=new s.Buf16(2*(2*A+1)),et(this.dyn_ltree),et(this.dyn_dtree),et(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(F+1),this.heap=new s.Buf16(2*_+1),et(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*_+1),et(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ft(n){var j;return n&&n.state?(n.total_in=n.total_out=0,n.data_type=h,(j=n.state).pending=0,j.pending_out=0,j.wrap<0&&(j.wrap=-j.wrap),j.status=j.wrap?E:T,n.adler=j.wrap===2?0:1,j.last_flush=y,o._tr_init(j),d):nt(n,m)}function Nt(n){var j=ft(n);return j===d&&function(B){B.window_size=2*B.w_size,et(B.head),B.max_lazy_match=r[B.level].max_lazy,B.good_match=r[B.level].good_length,B.nice_match=r[B.level].nice_length,B.max_chain_length=r[B.level].max_chain,B.strstart=0,B.block_start=0,B.lookahead=0,B.insert=0,B.match_length=B.prev_length=$-1,B.match_available=0,B.ins_h=0}(n.state),j}function At(n,j,B,S,b,I){if(!n)return m;var D=1;if(j===l&&(j=6),S<0?(D=0,S=-S):15<S&&(D=2,S-=16),b<1||k<b||B!==f||S<8||15<S||j<0||9<j||I<0||g<I)return nt(n,m);S===8&&(S=9);var P=new yt;return(n.state=P).strm=n,P.wrap=D,P.gzhead=null,P.w_bits=S,P.w_size=1<<P.w_bits,P.w_mask=P.w_size-1,P.hash_bits=b+7,P.hash_size=1<<P.hash_bits,P.hash_mask=P.hash_size-1,P.hash_shift=~~((P.hash_bits+$-1)/$),P.window=new s.Buf8(2*P.w_size),P.head=new s.Buf16(P.hash_size),P.prev=new s.Buf16(P.w_size),P.lit_bufsize=1<<b+6,P.pending_buf_size=4*P.lit_bufsize,P.pending_buf=new s.Buf8(P.pending_buf_size),P.d_buf=1*P.lit_bufsize,P.l_buf=3*P.lit_bufsize,P.level=j,P.strategy=I,P.method=B,Nt(n)}r=[new at(0,0,0,0,function(n,j){var B=65535;for(B>n.pending_buf_size-5&&(B=n.pending_buf_size-5);;){if(n.lookahead<=1){if(dt(n),n.lookahead===0&&j===y)return a;if(n.lookahead===0)break}n.strstart+=n.lookahead,n.lookahead=0;var S=n.block_start+B;if((n.strstart===0||n.strstart>=S)&&(n.lookahead=n.strstart-S,n.strstart=S,z(n,!1),n.strm.avail_out===0)||n.strstart-n.block_start>=n.w_size-Y&&(z(n,!1),n.strm.avail_out===0))return a}return n.insert=0,j===v?(z(n,!0),n.strm.avail_out===0?tt:q):(n.strstart>n.block_start&&(z(n,!1),n.strm.avail_out),a)}),new at(4,4,8,4,bt),new at(4,5,16,8,bt),new at(4,6,32,32,bt),new at(4,4,16,16,ot),new at(8,16,32,32,ot),new at(8,16,128,128,ot),new at(8,32,128,256,ot),new at(32,128,258,1024,ot),new at(32,258,258,4096,ot)],i.deflateInit=function(n,j){return At(n,j,f,15,8,0)},i.deflateInit2=At,i.deflateReset=Nt,i.deflateResetKeep=ft,i.deflateSetHeader=function(n,j){return n&&n.state?n.state.wrap!==2?m:(n.state.gzhead=j,d):m},i.deflate=function(n,j){var B,S,b,I;if(!n||!n.state||5<j||j<0)return n?nt(n,m):m;if(S=n.state,!n.output||!n.input&&n.avail_in!==0||S.status===666&&j!==v)return nt(n,n.avail_out===0?-5:m);if(S.strm=n,B=S.last_flush,S.last_flush=j,S.status===E)if(S.wrap===2)n.adler=0,Q(S,31),Q(S,139),Q(S,8),S.gzhead?(Q(S,(S.gzhead.text?1:0)+(S.gzhead.hcrc?2:0)+(S.gzhead.extra?4:0)+(S.gzhead.name?8:0)+(S.gzhead.comment?16:0)),Q(S,255&S.gzhead.time),Q(S,S.gzhead.time>>8&255),Q(S,S.gzhead.time>>16&255),Q(S,S.gzhead.time>>24&255),Q(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),Q(S,255&S.gzhead.os),S.gzhead.extra&&S.gzhead.extra.length&&(Q(S,255&S.gzhead.extra.length),Q(S,S.gzhead.extra.length>>8&255)),S.gzhead.hcrc&&(n.adler=w(n.adler,S.pending_buf,S.pending,0)),S.gzindex=0,S.status=69):(Q(S,0),Q(S,0),Q(S,0),Q(S,0),Q(S,0),Q(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),Q(S,3),S.status=T);else{var D=f+(S.w_bits-8<<4)<<8;D|=(2<=S.strategy||S.level<2?0:S.level<6?1:S.level===6?2:3)<<6,S.strstart!==0&&(D|=32),D+=31-D%31,S.status=T,V(S,D),S.strstart!==0&&(V(S,n.adler>>>16),V(S,65535&n.adler)),n.adler=1}if(S.status===69)if(S.gzhead.extra){for(b=S.pending;S.gzindex<(65535&S.gzhead.extra.length)&&(S.pending!==S.pending_buf_size||(S.gzhead.hcrc&&S.pending>b&&(n.adler=w(n.adler,S.pending_buf,S.pending-b,b)),O(n),b=S.pending,S.pending!==S.pending_buf_size));)Q(S,255&S.gzhead.extra[S.gzindex]),S.gzindex++;S.gzhead.hcrc&&S.pending>b&&(n.adler=w(n.adler,S.pending_buf,S.pending-b,b)),S.gzindex===S.gzhead.extra.length&&(S.gzindex=0,S.status=73)}else S.status=73;if(S.status===73)if(S.gzhead.name){b=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>b&&(n.adler=w(n.adler,S.pending_buf,S.pending-b,b)),O(n),b=S.pending,S.pending===S.pending_buf_size)){I=1;break}I=S.gzindex<S.gzhead.name.length?255&S.gzhead.name.charCodeAt(S.gzindex++):0,Q(S,I)}while(I!==0);S.gzhead.hcrc&&S.pending>b&&(n.adler=w(n.adler,S.pending_buf,S.pending-b,b)),I===0&&(S.gzindex=0,S.status=91)}else S.status=91;if(S.status===91)if(S.gzhead.comment){b=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>b&&(n.adler=w(n.adler,S.pending_buf,S.pending-b,b)),O(n),b=S.pending,S.pending===S.pending_buf_size)){I=1;break}I=S.gzindex<S.gzhead.comment.length?255&S.gzhead.comment.charCodeAt(S.gzindex++):0,Q(S,I)}while(I!==0);S.gzhead.hcrc&&S.pending>b&&(n.adler=w(n.adler,S.pending_buf,S.pending-b,b)),I===0&&(S.status=103)}else S.status=103;if(S.status===103&&(S.gzhead.hcrc?(S.pending+2>S.pending_buf_size&&O(n),S.pending+2<=S.pending_buf_size&&(Q(S,255&n.adler),Q(S,n.adler>>8&255),n.adler=0,S.status=T)):S.status=T),S.pending!==0){if(O(n),n.avail_out===0)return S.last_flush=-1,d}else if(n.avail_in===0&&W(j)<=W(B)&&j!==v)return nt(n,-5);if(S.status===666&&n.avail_in!==0)return nt(n,-5);if(n.avail_in!==0||S.lookahead!==0||j!==y&&S.status!==666){var P=S.strategy===2?function(R,Z){for(var X;;){if(R.lookahead===0&&(dt(R),R.lookahead===0)){if(Z===y)return a;break}if(R.match_length=0,X=o._tr_tally(R,0,R.window[R.strstart]),R.lookahead--,R.strstart++,X&&(z(R,!1),R.strm.avail_out===0))return a}return R.insert=0,Z===v?(z(R,!0),R.strm.avail_out===0?tt:q):R.last_lit&&(z(R,!1),R.strm.avail_out===0)?a:L}(S,j):S.strategy===3?function(R,Z){for(var X,H,J,lt,st=R.window;;){if(R.lookahead<=U){if(dt(R),R.lookahead<=U&&Z===y)return a;if(R.lookahead===0)break}if(R.match_length=0,R.lookahead>=$&&0<R.strstart&&(H=st[J=R.strstart-1])===st[++J]&&H===st[++J]&&H===st[++J]){lt=R.strstart+U;do;while(H===st[++J]&&H===st[++J]&&H===st[++J]&&H===st[++J]&&H===st[++J]&&H===st[++J]&&H===st[++J]&&H===st[++J]&&J<lt);R.match_length=U-(lt-J),R.match_length>R.lookahead&&(R.match_length=R.lookahead)}if(R.match_length>=$?(X=o._tr_tally(R,1,R.match_length-$),R.lookahead-=R.match_length,R.strstart+=R.match_length,R.match_length=0):(X=o._tr_tally(R,0,R.window[R.strstart]),R.lookahead--,R.strstart++),X&&(z(R,!1),R.strm.avail_out===0))return a}return R.insert=0,Z===v?(z(R,!0),R.strm.avail_out===0?tt:q):R.last_lit&&(z(R,!1),R.strm.avail_out===0)?a:L}(S,j):r[S.level].func(S,j);if(P!==tt&&P!==q||(S.status=666),P===a||P===tt)return n.avail_out===0&&(S.last_flush=-1),d;if(P===L&&(j===1?o._tr_align(S):j!==5&&(o._tr_stored_block(S,0,0,!1),j===3&&(et(S.head),S.lookahead===0&&(S.strstart=0,S.block_start=0,S.insert=0))),O(n),n.avail_out===0))return S.last_flush=-1,d}return j!==v?d:S.wrap<=0?1:(S.wrap===2?(Q(S,255&n.adler),Q(S,n.adler>>8&255),Q(S,n.adler>>16&255),Q(S,n.adler>>24&255),Q(S,255&n.total_in),Q(S,n.total_in>>8&255),Q(S,n.total_in>>16&255),Q(S,n.total_in>>24&255)):(V(S,n.adler>>>16),V(S,65535&n.adler)),O(n),0<S.wrap&&(S.wrap=-S.wrap),S.pending!==0?d:1)},i.deflateEnd=function(n){var j;return n&&n.state?(j=n.state.status)!==E&&j!==69&&j!==73&&j!==91&&j!==103&&j!==T&&j!==666?nt(n,m):(n.state=null,j===T?nt(n,-3):d):m},i.deflateSetDictionary=function(n,j){var B,S,b,I,D,P,R,Z,X=j.length;if(!n||!n.state||(I=(B=n.state).wrap)===2||I===1&&B.status!==E||B.lookahead)return m;for(I===1&&(n.adler=p(n.adler,j,X,0)),B.wrap=0,X>=B.w_size&&(I===0&&(et(B.head),B.strstart=0,B.block_start=0,B.insert=0),Z=new s.Buf8(B.w_size),s.arraySet(Z,j,X-B.w_size,B.w_size,0),j=Z,X=B.w_size),D=n.avail_in,P=n.next_in,R=n.input,n.avail_in=X,n.next_in=0,n.input=j,dt(B);B.lookahead>=$;){for(S=B.strstart,b=B.lookahead-($-1);B.ins_h=(B.ins_h<<B.hash_shift^B.window[S+$-1])&B.hash_mask,B.prev[S&B.w_mask]=B.head[B.ins_h],B.head[B.ins_h]=S,S++,--b;);B.strstart=S,B.lookahead=$-1,dt(B)}return B.strstart+=B.lookahead,B.block_start=B.strstart,B.insert=B.lookahead,B.lookahead=0,B.match_length=B.prev_length=$-1,B.match_available=0,n.next_in=P,n.input=R,n.avail_in=D,B.wrap=I,d},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,u,i){u.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,u,i){u.exports=function(r,s){var o,p,w,x,y,v,d,m,l,g,h,f,k,_,C,A,N,F,$,U,Y,E,T,a,L;o=r.state,p=r.next_in,a=r.input,w=p+(r.avail_in-5),x=r.next_out,L=r.output,y=x-(s-r.avail_out),v=x+(r.avail_out-257),d=o.dmax,m=o.wsize,l=o.whave,g=o.wnext,h=o.window,f=o.hold,k=o.bits,_=o.lencode,C=o.distcode,A=(1<<o.lenbits)-1,N=(1<<o.distbits)-1;t:do{k<15&&(f+=a[p++]<<k,k+=8,f+=a[p++]<<k,k+=8),F=_[f&A];e:for(;;){if(f>>>=$=F>>>24,k-=$,($=F>>>16&255)===0)L[x++]=65535&F;else{if(!(16&$)){if(!(64&$)){F=_[(65535&F)+(f&(1<<$)-1)];continue e}if(32&$){o.mode=12;break t}r.msg="invalid literal/length code",o.mode=30;break t}U=65535&F,($&=15)&&(k<$&&(f+=a[p++]<<k,k+=8),U+=f&(1<<$)-1,f>>>=$,k-=$),k<15&&(f+=a[p++]<<k,k+=8,f+=a[p++]<<k,k+=8),F=C[f&N];n:for(;;){if(f>>>=$=F>>>24,k-=$,!(16&($=F>>>16&255))){if(!(64&$)){F=C[(65535&F)+(f&(1<<$)-1)];continue n}r.msg="invalid distance code",o.mode=30;break t}if(Y=65535&F,k<($&=15)&&(f+=a[p++]<<k,(k+=8)<$&&(f+=a[p++]<<k,k+=8)),d<(Y+=f&(1<<$)-1)){r.msg="invalid distance too far back",o.mode=30;break t}if(f>>>=$,k-=$,($=x-y)<Y){if(l<($=Y-$)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break t}if(T=h,(E=0)===g){if(E+=m-$,$<U){for(U-=$;L[x++]=h[E++],--$;);E=x-Y,T=L}}else if(g<$){if(E+=m+g-$,($-=g)<U){for(U-=$;L[x++]=h[E++],--$;);if(E=0,g<U){for(U-=$=g;L[x++]=h[E++],--$;);E=x-Y,T=L}}}else if(E+=g-$,$<U){for(U-=$;L[x++]=h[E++],--$;);E=x-Y,T=L}for(;2<U;)L[x++]=T[E++],L[x++]=T[E++],L[x++]=T[E++],U-=3;U&&(L[x++]=T[E++],1<U&&(L[x++]=T[E++]))}else{for(E=x-Y;L[x++]=L[E++],L[x++]=L[E++],L[x++]=L[E++],2<(U-=3););U&&(L[x++]=L[E++],1<U&&(L[x++]=L[E++]))}break}}break}}while(p<w&&x<v);p-=U=k>>3,f&=(1<<(k-=U<<3))-1,r.next_in=p,r.next_out=x,r.avail_in=p<w?w-p+5:5-(p-w),r.avail_out=x<v?v-x+257:257-(x-v),o.hold=f,o.bits=k}},{}],49:[function(t,u,i){var r=t("../utils/common"),s=t("./adler32"),o=t("./crc32"),p=t("./inffast"),w=t("./inftrees"),x=1,y=2,v=0,d=-2,m=1,l=852,g=592;function h(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function f(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(E){var T;return E&&E.state?(T=E.state,E.total_in=E.total_out=T.total=0,E.msg="",T.wrap&&(E.adler=1&T.wrap),T.mode=m,T.last=0,T.havedict=0,T.dmax=32768,T.head=null,T.hold=0,T.bits=0,T.lencode=T.lendyn=new r.Buf32(l),T.distcode=T.distdyn=new r.Buf32(g),T.sane=1,T.back=-1,v):d}function _(E){var T;return E&&E.state?((T=E.state).wsize=0,T.whave=0,T.wnext=0,k(E)):d}function C(E,T){var a,L;return E&&E.state?(L=E.state,T<0?(a=0,T=-T):(a=1+(T>>4),T<48&&(T&=15)),T&&(T<8||15<T)?d:(L.window!==null&&L.wbits!==T&&(L.window=null),L.wrap=a,L.wbits=T,_(E))):d}function A(E,T){var a,L;return E?(L=new f,(E.state=L).window=null,(a=C(E,T))!==v&&(E.state=null),a):d}var N,F,$=!0;function U(E){if($){var T;for(N=new r.Buf32(512),F=new r.Buf32(32),T=0;T<144;)E.lens[T++]=8;for(;T<256;)E.lens[T++]=9;for(;T<280;)E.lens[T++]=7;for(;T<288;)E.lens[T++]=8;for(w(x,E.lens,0,288,N,0,E.work,{bits:9}),T=0;T<32;)E.lens[T++]=5;w(y,E.lens,0,32,F,0,E.work,{bits:5}),$=!1}E.lencode=N,E.lenbits=9,E.distcode=F,E.distbits=5}function Y(E,T,a,L){var tt,q=E.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new r.Buf8(q.wsize)),L>=q.wsize?(r.arraySet(q.window,T,a-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(L<(tt=q.wsize-q.wnext)&&(tt=L),r.arraySet(q.window,T,a-L,tt,q.wnext),(L-=tt)?(r.arraySet(q.window,T,a-L,L,0),q.wnext=L,q.whave=q.wsize):(q.wnext+=tt,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=tt))),0}i.inflateReset=_,i.inflateReset2=C,i.inflateResetKeep=k,i.inflateInit=function(E){return A(E,15)},i.inflateInit2=A,i.inflate=function(E,T){var a,L,tt,q,nt,W,et,O,z,Q,V,G,dt,bt,ot,at,yt,ft,Nt,At,n,j,B,S,b=0,I=new r.Buf8(4),D=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return d;(a=E.state).mode===12&&(a.mode=13),nt=E.next_out,tt=E.output,et=E.avail_out,q=E.next_in,L=E.input,W=E.avail_in,O=a.hold,z=a.bits,Q=W,V=et,j=v;t:for(;;)switch(a.mode){case m:if(a.wrap===0){a.mode=13;break}for(;z<16;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(2&a.wrap&&O===35615){I[a.check=0]=255&O,I[1]=O>>>8&255,a.check=o(a.check,I,2,0),z=O=0,a.mode=2;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&O)<<8)+(O>>8))%31){E.msg="incorrect header check",a.mode=30;break}if((15&O)!=8){E.msg="unknown compression method",a.mode=30;break}if(z-=4,n=8+(15&(O>>>=4)),a.wbits===0)a.wbits=n;else if(n>a.wbits){E.msg="invalid window size",a.mode=30;break}a.dmax=1<<n,E.adler=a.check=1,a.mode=512&O?10:12,z=O=0;break;case 2:for(;z<16;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(a.flags=O,(255&a.flags)!=8){E.msg="unknown compression method",a.mode=30;break}if(57344&a.flags){E.msg="unknown header flags set",a.mode=30;break}a.head&&(a.head.text=O>>8&1),512&a.flags&&(I[0]=255&O,I[1]=O>>>8&255,a.check=o(a.check,I,2,0)),z=O=0,a.mode=3;case 3:for(;z<32;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}a.head&&(a.head.time=O),512&a.flags&&(I[0]=255&O,I[1]=O>>>8&255,I[2]=O>>>16&255,I[3]=O>>>24&255,a.check=o(a.check,I,4,0)),z=O=0,a.mode=4;case 4:for(;z<16;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}a.head&&(a.head.xflags=255&O,a.head.os=O>>8),512&a.flags&&(I[0]=255&O,I[1]=O>>>8&255,a.check=o(a.check,I,2,0)),z=O=0,a.mode=5;case 5:if(1024&a.flags){for(;z<16;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}a.length=O,a.head&&(a.head.extra_len=O),512&a.flags&&(I[0]=255&O,I[1]=O>>>8&255,a.check=o(a.check,I,2,0)),z=O=0}else a.head&&(a.head.extra=null);a.mode=6;case 6:if(1024&a.flags&&(W<(G=a.length)&&(G=W),G&&(a.head&&(n=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Array(a.head.extra_len)),r.arraySet(a.head.extra,L,q,G,n)),512&a.flags&&(a.check=o(a.check,L,G,q)),W-=G,q+=G,a.length-=G),a.length))break t;a.length=0,a.mode=7;case 7:if(2048&a.flags){if(W===0)break t;for(G=0;n=L[q+G++],a.head&&n&&a.length<65536&&(a.head.name+=String.fromCharCode(n)),n&&G<W;);if(512&a.flags&&(a.check=o(a.check,L,G,q)),W-=G,q+=G,n)break t}else a.head&&(a.head.name=null);a.length=0,a.mode=8;case 8:if(4096&a.flags){if(W===0)break t;for(G=0;n=L[q+G++],a.head&&n&&a.length<65536&&(a.head.comment+=String.fromCharCode(n)),n&&G<W;);if(512&a.flags&&(a.check=o(a.check,L,G,q)),W-=G,q+=G,n)break t}else a.head&&(a.head.comment=null);a.mode=9;case 9:if(512&a.flags){for(;z<16;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(O!==(65535&a.check)){E.msg="header crc mismatch",a.mode=30;break}z=O=0}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),E.adler=a.check=0,a.mode=12;break;case 10:for(;z<32;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}E.adler=a.check=h(O),z=O=0,a.mode=11;case 11:if(a.havedict===0)return E.next_out=nt,E.avail_out=et,E.next_in=q,E.avail_in=W,a.hold=O,a.bits=z,2;E.adler=a.check=1,a.mode=12;case 12:if(T===5||T===6)break t;case 13:if(a.last){O>>>=7&z,z-=7&z,a.mode=27;break}for(;z<3;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}switch(a.last=1&O,z-=1,3&(O>>>=1)){case 0:a.mode=14;break;case 1:if(U(a),a.mode=20,T!==6)break;O>>>=2,z-=2;break t;case 2:a.mode=17;break;case 3:E.msg="invalid block type",a.mode=30}O>>>=2,z-=2;break;case 14:for(O>>>=7&z,z-=7&z;z<32;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if((65535&O)!=(O>>>16^65535)){E.msg="invalid stored block lengths",a.mode=30;break}if(a.length=65535&O,z=O=0,a.mode=15,T===6)break t;case 15:a.mode=16;case 16:if(G=a.length){if(W<G&&(G=W),et<G&&(G=et),G===0)break t;r.arraySet(tt,L,q,G,nt),W-=G,q+=G,et-=G,nt+=G,a.length-=G;break}a.mode=12;break;case 17:for(;z<14;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(a.nlen=257+(31&O),O>>>=5,z-=5,a.ndist=1+(31&O),O>>>=5,z-=5,a.ncode=4+(15&O),O>>>=4,z-=4,286<a.nlen||30<a.ndist){E.msg="too many length or distance symbols",a.mode=30;break}a.have=0,a.mode=18;case 18:for(;a.have<a.ncode;){for(;z<3;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}a.lens[D[a.have++]]=7&O,O>>>=3,z-=3}for(;a.have<19;)a.lens[D[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,B={bits:a.lenbits},j=w(0,a.lens,0,19,a.lencode,0,a.work,B),a.lenbits=B.bits,j){E.msg="invalid code lengths set",a.mode=30;break}a.have=0,a.mode=19;case 19:for(;a.have<a.nlen+a.ndist;){for(;at=(b=a.lencode[O&(1<<a.lenbits)-1])>>>16&255,yt=65535&b,!((ot=b>>>24)<=z);){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(yt<16)O>>>=ot,z-=ot,a.lens[a.have++]=yt;else{if(yt===16){for(S=ot+2;z<S;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(O>>>=ot,z-=ot,a.have===0){E.msg="invalid bit length repeat",a.mode=30;break}n=a.lens[a.have-1],G=3+(3&O),O>>>=2,z-=2}else if(yt===17){for(S=ot+3;z<S;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}z-=ot,n=0,G=3+(7&(O>>>=ot)),O>>>=3,z-=3}else{for(S=ot+7;z<S;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}z-=ot,n=0,G=11+(127&(O>>>=ot)),O>>>=7,z-=7}if(a.have+G>a.nlen+a.ndist){E.msg="invalid bit length repeat",a.mode=30;break}for(;G--;)a.lens[a.have++]=n}}if(a.mode===30)break;if(a.lens[256]===0){E.msg="invalid code -- missing end-of-block",a.mode=30;break}if(a.lenbits=9,B={bits:a.lenbits},j=w(x,a.lens,0,a.nlen,a.lencode,0,a.work,B),a.lenbits=B.bits,j){E.msg="invalid literal/lengths set",a.mode=30;break}if(a.distbits=6,a.distcode=a.distdyn,B={bits:a.distbits},j=w(y,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,B),a.distbits=B.bits,j){E.msg="invalid distances set",a.mode=30;break}if(a.mode=20,T===6)break t;case 20:a.mode=21;case 21:if(6<=W&&258<=et){E.next_out=nt,E.avail_out=et,E.next_in=q,E.avail_in=W,a.hold=O,a.bits=z,p(E,V),nt=E.next_out,tt=E.output,et=E.avail_out,q=E.next_in,L=E.input,W=E.avail_in,O=a.hold,z=a.bits,a.mode===12&&(a.back=-1);break}for(a.back=0;at=(b=a.lencode[O&(1<<a.lenbits)-1])>>>16&255,yt=65535&b,!((ot=b>>>24)<=z);){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(at&&!(240&at)){for(ft=ot,Nt=at,At=yt;at=(b=a.lencode[At+((O&(1<<ft+Nt)-1)>>ft)])>>>16&255,yt=65535&b,!(ft+(ot=b>>>24)<=z);){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}O>>>=ft,z-=ft,a.back+=ft}if(O>>>=ot,z-=ot,a.back+=ot,a.length=yt,at===0){a.mode=26;break}if(32&at){a.back=-1,a.mode=12;break}if(64&at){E.msg="invalid literal/length code",a.mode=30;break}a.extra=15&at,a.mode=22;case 22:if(a.extra){for(S=a.extra;z<S;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}a.length+=O&(1<<a.extra)-1,O>>>=a.extra,z-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=23;case 23:for(;at=(b=a.distcode[O&(1<<a.distbits)-1])>>>16&255,yt=65535&b,!((ot=b>>>24)<=z);){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(!(240&at)){for(ft=ot,Nt=at,At=yt;at=(b=a.distcode[At+((O&(1<<ft+Nt)-1)>>ft)])>>>16&255,yt=65535&b,!(ft+(ot=b>>>24)<=z);){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}O>>>=ft,z-=ft,a.back+=ft}if(O>>>=ot,z-=ot,a.back+=ot,64&at){E.msg="invalid distance code",a.mode=30;break}a.offset=yt,a.extra=15&at,a.mode=24;case 24:if(a.extra){for(S=a.extra;z<S;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}a.offset+=O&(1<<a.extra)-1,O>>>=a.extra,z-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){E.msg="invalid distance too far back",a.mode=30;break}a.mode=25;case 25:if(et===0)break t;if(G=V-et,a.offset>G){if((G=a.offset-G)>a.whave&&a.sane){E.msg="invalid distance too far back",a.mode=30;break}dt=G>a.wnext?(G-=a.wnext,a.wsize-G):a.wnext-G,G>a.length&&(G=a.length),bt=a.window}else bt=tt,dt=nt-a.offset,G=a.length;for(et<G&&(G=et),et-=G,a.length-=G;tt[nt++]=bt[dt++],--G;);a.length===0&&(a.mode=21);break;case 26:if(et===0)break t;tt[nt++]=a.length,et--,a.mode=21;break;case 27:if(a.wrap){for(;z<32;){if(W===0)break t;W--,O|=L[q++]<<z,z+=8}if(V-=et,E.total_out+=V,a.total+=V,V&&(E.adler=a.check=a.flags?o(a.check,tt,V,nt-V):s(a.check,tt,V,nt-V)),V=et,(a.flags?O:h(O))!==a.check){E.msg="incorrect data check",a.mode=30;break}z=O=0}a.mode=28;case 28:if(a.wrap&&a.flags){for(;z<32;){if(W===0)break t;W--,O+=L[q++]<<z,z+=8}if(O!==(4294967295&a.total)){E.msg="incorrect length check",a.mode=30;break}z=O=0}a.mode=29;case 29:j=1;break t;case 30:j=-3;break t;case 31:return-4;case 32:default:return d}return E.next_out=nt,E.avail_out=et,E.next_in=q,E.avail_in=W,a.hold=O,a.bits=z,(a.wsize||V!==E.avail_out&&a.mode<30&&(a.mode<27||T!==4))&&Y(E,E.output,E.next_out,V-E.avail_out)?(a.mode=31,-4):(Q-=E.avail_in,V-=E.avail_out,E.total_in+=Q,E.total_out+=V,a.total+=V,a.wrap&&V&&(E.adler=a.check=a.flags?o(a.check,tt,V,E.next_out-V):s(a.check,tt,V,E.next_out-V)),E.data_type=a.bits+(a.last?64:0)+(a.mode===12?128:0)+(a.mode===20||a.mode===15?256:0),(Q==0&&V===0||T===4)&&j===v&&(j=-5),j)},i.inflateEnd=function(E){if(!E||!E.state)return d;var T=E.state;return T.window&&(T.window=null),E.state=null,v},i.inflateGetHeader=function(E,T){var a;return E&&E.state&&2&(a=E.state).wrap?((a.head=T).done=!1,v):d},i.inflateSetDictionary=function(E,T){var a,L=T.length;return E&&E.state?(a=E.state).wrap!==0&&a.mode!==11?d:a.mode===11&&s(1,T,L,0)!==a.check?-3:Y(E,T,L,L)?(a.mode=31,-4):(a.havedict=1,v):d},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,u,i){var r=t("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],p=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],w=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];u.exports=function(x,y,v,d,m,l,g,h){var f,k,_,C,A,N,F,$,U,Y=h.bits,E=0,T=0,a=0,L=0,tt=0,q=0,nt=0,W=0,et=0,O=0,z=null,Q=0,V=new r.Buf16(16),G=new r.Buf16(16),dt=null,bt=0;for(E=0;E<=15;E++)V[E]=0;for(T=0;T<d;T++)V[y[v+T]]++;for(tt=Y,L=15;1<=L&&V[L]===0;L--);if(L<tt&&(tt=L),L===0)return m[l++]=20971520,m[l++]=20971520,h.bits=1,0;for(a=1;a<L&&V[a]===0;a++);for(tt<a&&(tt=a),E=W=1;E<=15;E++)if(W<<=1,(W-=V[E])<0)return-1;if(0<W&&(x===0||L!==1))return-1;for(G[1]=0,E=1;E<15;E++)G[E+1]=G[E]+V[E];for(T=0;T<d;T++)y[v+T]!==0&&(g[G[y[v+T]]++]=T);if(N=x===0?(z=dt=g,19):x===1?(z=s,Q-=257,dt=o,bt-=257,256):(z=p,dt=w,-1),E=a,A=l,nt=T=O=0,_=-1,C=(et=1<<(q=tt))-1,x===1&&852<et||x===2&&592<et)return 1;for(;;){for(F=E-nt,U=g[T]<N?($=0,g[T]):g[T]>N?($=dt[bt+g[T]],z[Q+g[T]]):($=96,0),f=1<<E-nt,a=k=1<<q;m[A+(O>>nt)+(k-=f)]=F<<24|$<<16|U|0,k!==0;);for(f=1<<E-1;O&f;)f>>=1;if(f!==0?(O&=f-1,O+=f):O=0,T++,--V[E]==0){if(E===L)break;E=y[v+g[T]]}if(tt<E&&(O&C)!==_){for(nt===0&&(nt=tt),A+=a,W=1<<(q=E-nt);q+nt<L&&!((W-=V[q+nt])<=0);)q++,W<<=1;if(et+=1<<q,x===1&&852<et||x===2&&592<et)return 1;m[_=O&C]=tt<<24|q<<16|A-l|0}}return O!==0&&(m[A+O]=E-nt<<24|64<<16|0),h.bits=tt,0}},{"../utils/common":41}],51:[function(t,u,i){u.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,u,i){var r=t("../utils/common"),s=0,o=1;function p(b){for(var I=b.length;0<=--I;)b[I]=0}var w=0,x=29,y=256,v=y+1+x,d=30,m=19,l=2*v+1,g=15,h=16,f=7,k=256,_=16,C=17,A=18,N=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],F=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],$=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Y=new Array(2*(v+2));p(Y);var E=new Array(2*d);p(E);var T=new Array(512);p(T);var a=new Array(256);p(a);var L=new Array(x);p(L);var tt,q,nt,W=new Array(d);function et(b,I,D,P,R){this.static_tree=b,this.extra_bits=I,this.extra_base=D,this.elems=P,this.max_length=R,this.has_stree=b&&b.length}function O(b,I){this.dyn_tree=b,this.max_code=0,this.stat_desc=I}function z(b){return b<256?T[b]:T[256+(b>>>7)]}function Q(b,I){b.pending_buf[b.pending++]=255&I,b.pending_buf[b.pending++]=I>>>8&255}function V(b,I,D){b.bi_valid>h-D?(b.bi_buf|=I<<b.bi_valid&65535,Q(b,b.bi_buf),b.bi_buf=I>>h-b.bi_valid,b.bi_valid+=D-h):(b.bi_buf|=I<<b.bi_valid&65535,b.bi_valid+=D)}function G(b,I,D){V(b,D[2*I],D[2*I+1])}function dt(b,I){for(var D=0;D|=1&b,b>>>=1,D<<=1,0<--I;);return D>>>1}function bt(b,I,D){var P,R,Z=new Array(g+1),X=0;for(P=1;P<=g;P++)Z[P]=X=X+D[P-1]<<1;for(R=0;R<=I;R++){var H=b[2*R+1];H!==0&&(b[2*R]=dt(Z[H]++,H))}}function ot(b){var I;for(I=0;I<v;I++)b.dyn_ltree[2*I]=0;for(I=0;I<d;I++)b.dyn_dtree[2*I]=0;for(I=0;I<m;I++)b.bl_tree[2*I]=0;b.dyn_ltree[2*k]=1,b.opt_len=b.static_len=0,b.last_lit=b.matches=0}function at(b){8<b.bi_valid?Q(b,b.bi_buf):0<b.bi_valid&&(b.pending_buf[b.pending++]=b.bi_buf),b.bi_buf=0,b.bi_valid=0}function yt(b,I,D,P){var R=2*I,Z=2*D;return b[R]<b[Z]||b[R]===b[Z]&&P[I]<=P[D]}function ft(b,I,D){for(var P=b.heap[D],R=D<<1;R<=b.heap_len&&(R<b.heap_len&&yt(I,b.heap[R+1],b.heap[R],b.depth)&&R++,!yt(I,P,b.heap[R],b.depth));)b.heap[D]=b.heap[R],D=R,R<<=1;b.heap[D]=P}function Nt(b,I,D){var P,R,Z,X,H=0;if(b.last_lit!==0)for(;P=b.pending_buf[b.d_buf+2*H]<<8|b.pending_buf[b.d_buf+2*H+1],R=b.pending_buf[b.l_buf+H],H++,P===0?G(b,R,I):(G(b,(Z=a[R])+y+1,I),(X=N[Z])!==0&&V(b,R-=L[Z],X),G(b,Z=z(--P),D),(X=F[Z])!==0&&V(b,P-=W[Z],X)),H<b.last_lit;);G(b,k,I)}function At(b,I){var D,P,R,Z=I.dyn_tree,X=I.stat_desc.static_tree,H=I.stat_desc.has_stree,J=I.stat_desc.elems,lt=-1;for(b.heap_len=0,b.heap_max=l,D=0;D<J;D++)Z[2*D]!==0?(b.heap[++b.heap_len]=lt=D,b.depth[D]=0):Z[2*D+1]=0;for(;b.heap_len<2;)Z[2*(R=b.heap[++b.heap_len]=lt<2?++lt:0)]=1,b.depth[R]=0,b.opt_len--,H&&(b.static_len-=X[2*R+1]);for(I.max_code=lt,D=b.heap_len>>1;1<=D;D--)ft(b,Z,D);for(R=J;D=b.heap[1],b.heap[1]=b.heap[b.heap_len--],ft(b,Z,1),P=b.heap[1],b.heap[--b.heap_max]=D,b.heap[--b.heap_max]=P,Z[2*R]=Z[2*D]+Z[2*P],b.depth[R]=(b.depth[D]>=b.depth[P]?b.depth[D]:b.depth[P])+1,Z[2*D+1]=Z[2*P+1]=R,b.heap[1]=R++,ft(b,Z,1),2<=b.heap_len;);b.heap[--b.heap_max]=b.heap[1],function(st,St){var Xt,zt,Yt,ht,ce,Ce,Bt=St.dyn_tree,cn=St.max_code,ur=St.stat_desc.static_tree,dr=St.stat_desc.has_stree,fr=St.stat_desc.extra_bits,un=St.stat_desc.extra_base,Jt=St.stat_desc.max_length,ue=0;for(ht=0;ht<=g;ht++)st.bl_count[ht]=0;for(Bt[2*st.heap[st.heap_max]+1]=0,Xt=st.heap_max+1;Xt<l;Xt++)Jt<(ht=Bt[2*Bt[2*(zt=st.heap[Xt])+1]+1]+1)&&(ht=Jt,ue++),Bt[2*zt+1]=ht,cn<zt||(st.bl_count[ht]++,ce=0,un<=zt&&(ce=fr[zt-un]),Ce=Bt[2*zt],st.opt_len+=Ce*(ht+ce),dr&&(st.static_len+=Ce*(ur[2*zt+1]+ce)));if(ue!==0){do{for(ht=Jt-1;st.bl_count[ht]===0;)ht--;st.bl_count[ht]--,st.bl_count[ht+1]+=2,st.bl_count[Jt]--,ue-=2}while(0<ue);for(ht=Jt;ht!==0;ht--)for(zt=st.bl_count[ht];zt!==0;)cn<(Yt=st.heap[--Xt])||(Bt[2*Yt+1]!==ht&&(st.opt_len+=(ht-Bt[2*Yt+1])*Bt[2*Yt],Bt[2*Yt+1]=ht),zt--)}}(b,I),bt(Z,lt,b.bl_count)}function n(b,I,D){var P,R,Z=-1,X=I[1],H=0,J=7,lt=4;for(X===0&&(J=138,lt=3),I[2*(D+1)+1]=65535,P=0;P<=D;P++)R=X,X=I[2*(P+1)+1],++H<J&&R===X||(H<lt?b.bl_tree[2*R]+=H:R!==0?(R!==Z&&b.bl_tree[2*R]++,b.bl_tree[2*_]++):H<=10?b.bl_tree[2*C]++:b.bl_tree[2*A]++,Z=R,lt=(H=0)===X?(J=138,3):R===X?(J=6,3):(J=7,4))}function j(b,I,D){var P,R,Z=-1,X=I[1],H=0,J=7,lt=4;for(X===0&&(J=138,lt=3),P=0;P<=D;P++)if(R=X,X=I[2*(P+1)+1],!(++H<J&&R===X)){if(H<lt)for(;G(b,R,b.bl_tree),--H!=0;);else R!==0?(R!==Z&&(G(b,R,b.bl_tree),H--),G(b,_,b.bl_tree),V(b,H-3,2)):H<=10?(G(b,C,b.bl_tree),V(b,H-3,3)):(G(b,A,b.bl_tree),V(b,H-11,7));Z=R,lt=(H=0)===X?(J=138,3):R===X?(J=6,3):(J=7,4)}}p(W);var B=!1;function S(b,I,D,P){V(b,(w<<1)+(P?1:0),3),function(R,Z,X,H){at(R),Q(R,X),Q(R,~X),r.arraySet(R.pending_buf,R.window,Z,X,R.pending),R.pending+=X}(b,I,D)}i._tr_init=function(b){B||(function(){var I,D,P,R,Z,X=new Array(g+1);for(R=P=0;R<x-1;R++)for(L[R]=P,I=0;I<1<<N[R];I++)a[P++]=R;for(a[P-1]=R,R=Z=0;R<16;R++)for(W[R]=Z,I=0;I<1<<F[R];I++)T[Z++]=R;for(Z>>=7;R<d;R++)for(W[R]=Z<<7,I=0;I<1<<F[R]-7;I++)T[256+Z++]=R;for(D=0;D<=g;D++)X[D]=0;for(I=0;I<=143;)Y[2*I+1]=8,I++,X[8]++;for(;I<=255;)Y[2*I+1]=9,I++,X[9]++;for(;I<=279;)Y[2*I+1]=7,I++,X[7]++;for(;I<=287;)Y[2*I+1]=8,I++,X[8]++;for(bt(Y,v+1,X),I=0;I<d;I++)E[2*I+1]=5,E[2*I]=dt(I,5);tt=new et(Y,N,y+1,v,g),q=new et(E,F,0,d,g),nt=new et(new Array(0),$,0,m,f)}(),B=!0),b.l_desc=new O(b.dyn_ltree,tt),b.d_desc=new O(b.dyn_dtree,q),b.bl_desc=new O(b.bl_tree,nt),b.bi_buf=0,b.bi_valid=0,ot(b)},i._tr_stored_block=S,i._tr_flush_block=function(b,I,D,P){var R,Z,X=0;0<b.level?(b.strm.data_type===2&&(b.strm.data_type=function(H){var J,lt=4093624447;for(J=0;J<=31;J++,lt>>>=1)if(1<&&H.dyn_ltree[2*J]!==0)return s;if(H.dyn_ltree[18]!==0||H.dyn_ltree[20]!==0||H.dyn_ltree[26]!==0)return o;for(J=32;J<y;J++)if(H.dyn_ltree[2*J]!==0)return o;return s}(b)),At(b,b.l_desc),At(b,b.d_desc),X=function(H){var J;for(n(H,H.dyn_ltree,H.l_desc.max_code),n(H,H.dyn_dtree,H.d_desc.max_code),At(H,H.bl_desc),J=m-1;3<=J&&H.bl_tree[2*U[J]+1]===0;J--);return H.opt_len+=3*(J+1)+5+5+4,J}(b),R=b.opt_len+3+7>>>3,(Z=b.static_len+3+7>>>3)<=R&&(R=Z)):R=Z=D+5,D+4<=R&&I!==-1?S(b,I,D,P):b.strategy===4||Z===R?(V(b,2+(P?1:0),3),Nt(b,Y,E)):(V(b,4+(P?1:0),3),function(H,J,lt,st){var St;for(V(H,J-257,5),V(H,lt-1,5),V(H,st-4,4),St=0;St<st;St++)V(H,H.bl_tree[2*U[St]+1],3);j(H,H.dyn_ltree,J-1),j(H,H.dyn_dtree,lt-1)}(b,b.l_desc.max_code+1,b.d_desc.max_code+1,X+1),Nt(b,b.dyn_ltree,b.dyn_dtree)),ot(b),P&&at(b)},i._tr_tally=function(b,I,D){return b.pending_buf[b.d_buf+2*b.last_lit]=I>>>8&255,b.pending_buf[b.d_buf+2*b.last_lit+1]=255&I,b.pending_buf[b.l_buf+b.last_lit]=255&D,b.last_lit++,I===0?b.dyn_ltree[2*D]++:(b.matches++,I--,b.dyn_ltree[2*(a[D]+y+1)]++,b.dyn_dtree[2*z(I)]++),b.last_lit===b.lit_bufsize-1},i._tr_align=function(b){V(b,2,3),G(b,k,Y),function(I){I.bi_valid===16?(Q(I,I.bi_buf),I.bi_buf=0,I.bi_valid=0):8<=I.bi_valid&&(I.pending_buf[I.pending++]=255&I.bi_buf,I.bi_buf>>=8,I.bi_valid-=8)}(b)}},{"../utils/common":41}],53:[function(t,u,i){u.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,u,i){(function(r){(function(s,o){if(!s.setImmediate){var p,w,x,y,v=1,d={},m=!1,l=s.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(s);g=g&&g.setTimeout?g:s,p={}.toString.call(s.process)==="[object process]"?function(_){process.nextTick(function(){f(_)})}:function(){if(s.postMessage&&!s.importScripts){var _=!0,C=s.onmessage;return s.onmessage=function(){_=!1},s.postMessage("","*"),s.onmessage=C,_}}()?(y="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(_){s.postMessage(y+_,"*")}):s.MessageChannel?((x=new MessageChannel).port1.onmessage=function(_){f(_.data)},function(_){x.port2.postMessage(_)}):l&&"onreadystatechange"in l.createElement("script")?(w=l.documentElement,function(_){var C=l.createElement("script");C.onreadystatechange=function(){f(_),C.onreadystatechange=null,w.removeChild(C),C=null},w.appendChild(C)}):function(_){setTimeout(f,0,_)},g.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var C=new Array(arguments.length-1),A=0;A<C.length;A++)C[A]=arguments[A+1];var N={callback:_,args:C};return d[v]=N,p(v),v++},g.clearImmediate=h}function h(_){delete d[_]}function f(_){if(m)setTimeout(f,0,_);else{var C=d[_];if(C){m=!0;try{(function(A){var N=A.callback,F=A.args;switch(F.length){case 0:N();break;case 1:N(F[0]);break;case 2:N(F[0],F[1]);break;case 3:N(F[0],F[1],F[2]);break;default:N.apply(o,F)}})(C)}finally{h(_),m=!1}}}}function k(_){_.source===s&&typeof _.data=="string"&&_.data.indexOf(y)===0&&f(+_.data.slice(y.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof ie<"u"?ie:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Ue);var Mn=Ue.exports;const Wn=Un(Mn),Ut=(e,c)=>{const t=e==null?void 0:e.getAttribute(c);return t==null||t===""?null:t};function Me(e){const c=Number(Ut(e,"type")??0),t=Ut(e,"solution");return{type:c,typeName:vt(c),schemaName:Ut(e,"schemaName"),displayName:Ut(e,"displayName"),id:Ut(e,"id"),solution:t&&t.replace(/\s*\([\d.]+\)\s*$/,"").trim()||null,parentSchemaName:Ut(e,"parentSchemaName")}}const Ot=e=>e.schemaName??e.displayName??e.id??"(unnamed)";function Zn(e){const c=new DOMParser().parseFromString(e,"application/xml");if(c.getElementsByTagName("parsererror").length)throw new Error("solution.xml: invalid XML");const t=c.querySelector("ImportExportXml > SolutionManifest");if(!t)throw new Error("solution.xml: SolutionManifest not found");const u=r=>{var s,o;return((o=(s=t.querySelector(r))==null?void 0:s.textContent)==null?void 0:o.trim())??""},i=Array.from(t.querySelectorAll(":scope > MissingDependencies > MissingDependency")).map(r=>({required:Me(r.querySelector(":scope > Required")),dependent:Me(r.querySelector(":scope > Dependent"))}));return{uniqueName:u(":scope > UniqueName"),version:u(":scope > Version"),managed:u(":scope > Managed")!=="0"&&u(":scope > Managed")!=="",missing:i}}function Hn(e,c,t){const u=new Map;for(const i of e){const r=i.required,s=Ht(c,null,Ot(r))||!!r.solution&&Ht(c,{uniqueName:r.solution,prefix:""},Ot(r)),o=!!r.solution&&!!(t!=null&&t.has(r.solution.toLowerCase()));if(!s&&!(t&&r.solution&&!o))continue;const p=i.dependent,w=`${p.type}:${(p.id??Ot(p)).toLowerCase()}:${p.parentSchemaName??""}`,x=u.get(w)??{key:w,dependent:p,required:[],status:"safe"};x.required.some(y=>y.type===r.type&&Ot(y)===Ot(r))||x.required.push({...r,safe:o}),o||(x.status="blocker"),u.set(w,x)}return[...u.values()].sort((i,r)=>(i.status===r.status?0:i.status==="blocker"?-1:1)||i.dependent.type-r.dependent.type||Ot(i.dependent).localeCompare(Ot(r.dependent)))}async function Gn(e,c,t,u){let i;try{i=await Wn.loadAsync(c)}catch{throw new Error(`${e}: not a zip file`)}const r=i.file(/^solution\.xml$/i)[0];if(!r)throw new Error(`${e}: solution.xml not found (is this a solution export?)`);const s=Zn(await r.async("string"));return{fileName:e,uniqueName:s.uniqueName,version:s.version,managed:s.managed,total:s.missing.length,groups:Hn(s.missing,t,u)}}const We=()=>window,Tt=()=>We().toolboxAPI,Ze=()=>We().dataverseAPI,He=()=>{var e;return!!((e=Tt())!=null&&e.connections)&&!!Ze()};async function Kn(){var i,r;const e=Tt();if(!(e!=null&&e.connections))return[];const c=[],t=await e.connections.getActiveConnection().catch(()=>null);t&&c.push({target:"primary",conn:t});const u=await((r=(i=e.connections).getSecondaryConnection)==null?void 0:r.call(i).catch(()=>null));return u&&c.push({target:"secondary",conn:u}),c}function Vn(e){var c,t;try{(t=(c=Tt())==null?void 0:c.events)==null||t.on((u,i)=>{typeof(i==null?void 0:i.event)=="string"&&i.event.startsWith("connection:")&&e()})}catch{}}async function Xn(e){var u,i,r,s;const c=Tt();let t=(u=window.matchMedia)!=null&&u.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light";if((i=c==null?void 0:c.utils)!=null&&i.getCurrentTheme)try{t=await c.utils.getCurrentTheme()}catch{}e(t);try{(r=c==null?void 0:c.events)==null||r.on((o,p)=>{var w;if((p==null?void 0:p.event)==="settings:updated"){const x=(w=p.data)==null?void 0:w.theme;(x==="light"||x==="dark")&&e(x)}})}catch{}c||(s=window.matchMedia)==null||s.call(window,"(prefers-color-scheme: dark)").addEventListener("change",o=>e(o.matches?"dark":"light"))}async function _t(e,c,t="info"){var i;const u=Tt();if((i=u==null?void 0:u.utils)!=null&&i.showNotification)try{await u.utils.showNotification({title:e,body:c,type:t,duration:4e3});return}catch{}console[t==="error"?"error":"log"](`${e}: ${c}`)}async function Ge(e,c,t="application/json"){var s;const u=Tt();if((s=u==null?void 0:u.fileSystem)!=null&&s.saveFile)return!!await u.fileSystem.saveFile(e,c);const i=URL.createObjectURL(new Blob([c],{type:t})),r=document.createElement("a");return r.href=i,r.download=e,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3),!0}function Yn(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);const c=e;if(c&&c.type==="Buffer"&&Array.isArray(c.data))return Uint8Array.from(c.data);if(Array.isArray(e))return Uint8Array.from(e);throw new Error("Unsupported binary payload from host")}function Ke(e,c){return new Promise(t=>{const u=document.createElement("input");u.type="file",u.accept=e,u.multiple=c,u.addEventListener("change",()=>t(Array.from(u.files??[]))),u.addEventListener("cancel",()=>t([])),u.click()})}async function Jn(e){var u;const c=Tt();if((u=c==null?void 0:c.fileSystem)!=null&&u.selectPath){const i=await c.fileSystem.selectPath({type:"file",title:e.title,filters:[{name:e.extensions.map(s=>s.toUpperCase()).join(" / "),extensions:e.extensions},{name:"All files",extensions:["*"]}]});if(!i)return[];const r=await c.fileSystem.readBinary(i);return[{name:i.split(/[\\/]/).pop()??i,data:Yn(r)}]}const t=await Ke(e.extensions.map(i=>`.${i}`).join(","),!!e.multiple);return Promise.all(t.map(async i=>({name:i.name,data:new Uint8Array(await i.arrayBuffer())})))}async function Qn(e){var u;const c=Tt();if((u=c==null?void 0:c.fileSystem)!=null&&u.selectPath){const i=await c.fileSystem.selectPath({type:"file",title:e.title,filters:[{name:e.extensions.join("/"),extensions:e.extensions}]});return i?{name:i.split(/[\\/]/).pop()??i,text:await c.fileSystem.readText(i)}:null}const[t]=await Ke(e.extensions.map(i=>`.${i}`).join(","),!1);return t?{name:t.name,text:await t.text()}:null}let be=[],Ft=[],jt=null,we=new Re;const Ve=new Map;let Gt,rt=null;const $t=new Map;let kt=null,xt=[],Mt=!1,ve=!1,_e=!1,ut=null;const Wt=()=>Ze(),wt=()=>be.find(e=>e.target==="primary"),Xe=()=>be.find(e=>e.target==="secondary"),Kt=e=>!!e&&(e.conn.environment==="Production"||/\bprod/i.test(e.conn.name)),se=()=>{var t;const e=((t=wt())==null?void 0:t.conn.url)??"";let c=Ve.get(e);return c||Ve.set(e,c=new Map),c},ke=()=>{const e=Tn(K("#filter").value);return e.length?e:pn};function Et(e){const c=K("#status");c.hidden=!e,c.textContent=e??""}function Ye(e,c){const t=M("span",{class:"dot"});return e.conn.environmentColor&&(t.style.background=e.conn.environmentColor),M("span",{class:"connchip",title:e.conn.url},t,M("span",{class:"env"},e.conn.name),M("span",{class:"kind"},`${c} · ${e.conn.environment}`))}function Je(){const e=wt(),c=rt==null?void 0:rt.solution;return!e||!c?"https://make.powerapps.com/":Gt?`https://make.powerapps.com/environments/${Gt}/solutions/${c.id}`:`${e.conn.url.replace(/\/+$/,"")}/tools/solution/edit.aspx?id=${c.id}`}async function Qe(){be=await Kn(),we=new Re,Gt=void 0;const e=K("#conn");e.replaceChildren();const c=wt(),t=Xe();c&&e.append(Ye(c,"dev")),t&&e.append(Ye(t,"target")),c||e.append(M("span",{class:"caption"},He()?"No connection. Pick a primary (dev) connection in ToolBox.":"Standalone: Offline tab only."));const u=Wt();if(Ft=[],jt=null,u&&c){Et("Loading solutions…");try{Ft=await he(u,"primary")}catch(o){await _t("Load failed",o.message,"error")}if(t)try{jt=new Set((await he(u,"secondary")).map(o=>o.uniqueName.toLowerCase()))}catch(o){await _t("Target load failed",`${t.conn.name}: ${o.message}`,"warning")}Et(null)}const i=K("#solution"),r=i.value,s=Ft.filter(o=>!o.isManaged&&!["default","active","basic"].includes(o.uniqueName.toLowerCase()));i.replaceChildren(...s.length?s.map(o=>M("option",{value:o.id},`${o.friendlyName} (${o.uniqueName}) ${o.version}`)):[M("option",{value:""},c?"No unmanaged solutions":"No connection")]),[...i.options].some(o=>o.value===r)&&(i.value=r),K("#btn-run").disabled=!s.length}async function tn(){const e=Wt(),c=wt(),t=Ft.find(i=>i.id===K("#solution").value);if(!e||!c||!t||_e)return;_e=!0,ve=!1,K("#btn-cancel").hidden=!1,K("#btn-run").disabled=!0,K("#progress").hidden=!1;const u=K("#progress-bar");try{Gt===void 0&&(Gt=await _n(e));const i=Xe();rt=await Fn({api:e,meta:we,reqCache:se(),solution:t,allSolutions:Ft,targetSolutions:jt,filter:ke(),environment:{name:c.conn.name,url:c.conn.url,environment:c.conn.environment},target:i&&jt?{name:i.conn.name,url:i.conn.url}:null,link:()=>Je(),onProgress:(r,s)=>{u.max=Math.max(s,1),u.value=r,K("#progress-text").textContent=`RetrieveRequiredComponents ${r} / ${s}`},cancelled:()=>ve});for(const r of rt.findings)for(const s of r.fixes)s.kind==="report"&&(s.link=Je());for(const r of[...$t.keys()])rt.findings.some(s=>s.key===r)||$t.delete(r)}catch(i){i instanceof Fe?await _t("Cancelled","Diagnosis cancelled. Finished calls stay cached.","info"):await _t("Diagnosis failed",i.message,"error")}finally{_e=!1,K("#btn-cancel").hidden=!0,K("#btn-run").disabled=!1,K("#progress").hidden=!0}ae()}function tr(e){var t;const c=!!e.solution&&!!(jt!=null&&jt.has(e.solution.uniqueName.toLowerCase()));return M("span",{class:`req${c?" is-safe":""}`,title:e.solutions.join(", ")},M("span",{class:"sol"},((t=e.solution)==null?void 0:t.uniqueName)??"unknown solution"),`${vt(e.type)} ${e.name}`,c?" · in target":"")}function er(e){const c=M("select",{class:"fix","aria-label":`Fix for ${e.dependent.name}`});c.append(M("option",{value:""},"No action"),...e.fixes.map(u=>M("option",{value:u.kind},u.label))),c.value=$t.get(e.key)??"",c.addEventListener("change",()=>{c.value?$t.set(e.key,c.value):$t.delete(e.key),en()});const t=e.fixes.find(u=>u.kind==="report");return M("li",{class:`finding${e.status==="safe"?" is-safe":""}`,"data-key":e.key},M("div",{class:"head"},pt(vt(e.dependent.type),"neutral"),M("span",{class:"name mono"},e.dependent.name),e.dependent.table||e.dependent.rootTable?M("span",{class:"caption"},e.dependent.table??e.dependent.rootTable??""):null,e.dependent.rootBehavior===0?pt("table: all assets","warn"):null,pt(e.status==="blocker"?"blocker":"present in target",e.status==="blocker"?"bad":"ok"),c),M("div",{class:"cause"},e.cause),M("div",{class:"chips"},...e.required.map(tr)),t!=null&&t.link?M("div",{class:"caption"},t.note??""," ",M("a",{href:t.link,target:"_blank",rel:"noopener"},"Open solution in maker portal")):null)}function en(){K("#sel-count").textContent=`${$t.size} selected`,K("#btn-to-fix").disabled=$t.size===0}function ae(){const e=K("#findings"),c=K("#diag-summary");e.replaceChildren(),c.replaceChildren(),K("#diag-actions").hidden=!rt;for(const o of["#btn-export-json","#btn-export-csv"])K(o).toggleAttribute("disabled",!rt);if(!rt){e.append(Lt("No diagnosis yet",wt()?"Pick an unmanaged solution and run Diagnose.":"Connect a dev environment in ToolBox, or use the Offline tab."));return}const t=rt,u=t.findings.filter(o=>o.status==="blocker"),i=t.findings.length-u.length,r=K("#show-safe").checked;c.append(M("div",{class:"summary"},M("strong",{},`${t.solution.friendlyName}`),`${t.components.length} components ·`,pt(`${u.length} blocker${u.length===1?"":"s"}`,u.length?"bad":"ok"),t.target?pt(`${i} present in target`,"ok"):M("span",{class:"caption"},"No target connection: every dependency matching the filter counts."),t.errors.length?pt(`${t.errors.length} lookups failed`,"warn"):null)),t.errors.length&&c.append(M("div",{class:"warnings"},`RetrieveRequiredComponents failed for ${t.errors.length} component(s): ${t.errors.slice(0,3).map(o=>`${o.component} (${o.error})`).join("; ")}`));const s=t.findings.filter(o=>r||o.status==="blocker");s.length?e.append(M("ul",{class:"findings"},...s.map(er))):e.append(Lt("No blocking dependencies",t.findings.length?"Everything found is present in the target. Tick “Show present in target” to see it.":"Nothing in this solution depends on the filtered solutions.")),en()}function xe(e,c,t){const u=M("pre",{class:"diff","aria-label":t});for(const i of zn(e,c))u.append(M("span",{class:i.t==="-"?"del":i.t==="+"?"add":i.t==="…"?"gap":"ctx"},i.t==="…"?"…":`${i.t} ${i.s}`));return u}function nn(e){const c=M("li",{class:"op","data-kind":e.kind},M("span",{class:"mono"},ye(e)));if((e.kind==="remove"||e.kind==="add")&&c.append(" ",M("span",{class:"why"},e.reason)),e.kind==="update-form"){const t=e.edit;It(c,t.removed.length?M("div",{class:"caption"},`Removes: ${t.removed.join(", ")}`):null,t.kept.length?M("div",{class:"caption"},`Kept: ${t.kept.map(u=>`${u.name} (${u.reason})`).join(", ")}`):null,t.warnings.length?M("div",{class:"warnings"},t.warnings.join(" ")):null,xe(t.form.formxml,t.after,`formxml diff ${t.form.name}`))}if(e.kind==="update-view"){const t=e.edit;It(c,t.removed.length?M("div",{class:"caption"},`Removes: ${t.removed.join(", ")}`):null,t.warnings.length?M("div",{class:"warnings"},t.warnings.join(" ")):null,xe(t.view.fetchxml,t.after.fetchxml,`fetchxml diff ${t.view.name}`),xe(t.view.layoutxml,t.after.layoutxml,`layoutxml diff ${t.view.name}`))}return c}function rn(){return!!(rt!=null&&rt.solution.isManaged)}function Se(){const e=!Kt(wt())||K("#prod-ack").checked;K("#btn-confirm").disabled=!(Mt&&xt.length&&e&&!rn()),K("#btn-backup").textContent=Mt?"1. Backup saved ✓":"1. Download backup"}function le(){const e=K("#fix-banners"),c=K("#fix-body");if(e.replaceChildren(),c.replaceChildren(),K("#fix-actions").hidden=!kt,!kt||!rt){c.append(Lt("Nothing selected","Pick a fix on one or more findings in Diagnose, then Preview fixes."));return}rn()&&e.append(M("div",{class:"danger-banner"},`${rt.solution.uniqueName} is managed. Writes are refused: fix dependencies in the dev environment, in the unmanaged solution.`)),Kt(wt())&&e.append(M("div",{class:"danger-banner"},`This connection (${wt().conn.name}) looks like Production. Dependencies are fixed in dev.`)),K("#prod-ack-wrap").hidden=!Kt(wt());for(const t of kt.shells){const u=t.leaving.map(i=>{const r=M("input",{type:"checkbox","aria-label":`Keep ${i.component.name}`});return r.checked=i.keep,r.addEventListener("change",()=>{i.keep=r.checked,xt=Te(kt),on()}),M("label",{title:i.why},r,pt(vt(i.component.type),"neutral"),M("span",{class:"mono"},i.component.name??i.component.objectId),M("span",{class:"caption"},i.why))});c.append(M("div",{class:"card"},M("div",{class:"card-head"},M("h3",{},`Shell conversion: ${t.root.name}`),pt(`${t.leaving.filter(i=>!i.keep).length} leave`,"warn")),M("div",{class:"card-body"},M("p",{class:"caption"},"The table is removed and added back without subcomponents. Every subcomponent below leaves the solution unless ticked to re-add. Other developers may rely on them."),t.leaving.length?M("div",{class:"leaving"},...u):M("p",{class:"caption"},"No subcomponent rows."))))}kt.skipped.length&&c.append(M("div",{class:"warnings"},"Not changed: ",kt.skipped.map(t=>`${t.name} (${t.reason})`).join("; "))),c.append(M("div",{id:"ops-wrap"})),on()}function on(){const e=document.getElementById("ops-wrap");e&&(e.replaceChildren(M("h3",{},`${xt.length} operation${xt.length===1?"":"s"} on ${(rt==null?void 0:rt.solution.uniqueName)??""}`),xt.length?M("ol",{class:"ops",id:"ops"},...xt.map(nn)):Lt("No operations","The selected fixes change nothing.")),Se())}async function nr(){const e=Wt();if(!e||!rt)return;const c=[...$t].map(([t,u])=>({finding:rt.findings.find(i=>i.key===t),fix:u})).filter(t=>t.finding);Et("Preparing preview…");try{kt=await En(e,we,rt,c),xt=Te(kt),Mt=!1,K("#prod-ack").checked=!1,K("#fix-results").replaceChildren()}catch(t){await _t("Preview failed",t.message,"error")}finally{Et(null)}document.querySelector('.tab[data-tab="fix"]').click(),le()}async function rr(){if(!rt||!kt)return;const e=Rn(rt,kt,xt);await Ge(On(rt.solution.uniqueName),JSON.stringify(e,null,2))&&(Mt=!0,await _t("Backup saved","Keep it: the Restore tab reapplies it.","success")),Se()}function sn(e){return M("table",{},M("thead",{},M("tr",{},M("th",{},"Operation"),M("th",{},"Result"))),M("tbody",{},...e.map(c=>M("tr",{},M("td",{class:"mono"},ye(c.op)),M("td",{},c.ok?pt("ok","ok"):c.skipped?pt(c.error??"skipped","neutral"):pt(c.error??"failed","bad"))))))}async function ir(){const e=Wt();if(!e||!rt||!kt||!Mt||!xt.length)return;const c=rt.solution,t=await Ne(e,c.id).catch(()=>null);if(!t||t.isManaged||c.isManaged){rt={...rt,solution:{...rt.solution,isManaged:!0}},le(),await _t("Refused",`${c.uniqueName} is managed (or could not be read). Nothing was written.`,"error");return}K("#btn-confirm").disabled=!0;const u=rt.findings.filter(x=>x.status==="blocker").map(x=>x.key),i=new Set;for(const x of xt)x.kind==="update-form"&&i.add(Rt(it.Form,x.edit.form.id)),x.kind==="update-view"&&i.add(Rt(it.View,x.edit.view.id)),(x.kind==="remove"||x.kind==="add")&&i.add(Rt(x.component.type,x.component.id));const r=await je(e,xt,t.uniqueName,(x,y)=>Et(x<y?`Applying ${x+1} / ${y}…`:null));Et(null);const s=r.filter(x=>!x.ok&&!x.skipped).length;await _t(s?"Some operations failed":"Applied",s?"Restore from the backup if needed.":`${r.length} operations done. Re-running diagnosis…`,s?"error":"success");for(const x of i)se().delete(x);kt=null,xt=[],$t.clear(),Mt=!1,le();const o=K("#fix-results");o.replaceChildren(M("h3",{},"Results"),sn(r)),await tn();const p=new Set(((rt==null?void 0:rt.findings)??[]).filter(x=>x.status==="blocker").map(x=>x.key)),w=u.filter(x=>!p.has(x)).length;o.append(M("div",{class:"summary",id:"rediag"},M("strong",{},"Re-diagnosis:"),pt(`${w} fixed`,"ok"),pt(`${u.length-w} still present`,u.length-w?"bad":"ok"),pt(`${p.size} blockers now`,p.size?"bad":"ok")))}async function or(){const e=await Qn({title:"Open Dependency Cleaner backup",extensions:["json"]});if(!e)return;K("#restore-results").replaceChildren();try{ut={backup:$n(e.text),plan:null},K("#restore-file").textContent=e.name}catch(u){ut=null,await _t("Backup rejected",`${e.name}: ${u.message}`,"error"),Vt();return}const c=Wt(),t=wt();if(c&&t){Et("Comparing backup to the environment…");try{ut.plan=await Bn(c,ut.backup,Ft.length?Ft:await he(c,"primary"),t.conn.url)}catch(u){await _t("Restore refused",u.message,"error"),Vt(u.message),Et(null);return}Et(null)}Vt()}function Vt(e){var u;const c=K("#restore-body");if(c.replaceChildren(),K("#restore-actions").hidden=!(ut!=null&&ut.plan),K("#btn-restore-apply").disabled=!((u=ut==null?void 0:ut.plan)!=null&&u.ops.length),!ut){c.append(Lt("No backup loaded","Load a dependency-cleaner-backup-*.json file saved before a fix."));return}const t=ut.backup;if(c.append(M("p",{class:"caption"},`Backup of ${t.solution.uniqueName} from ${t.environment.name}, ${t.takenAt}. ${t.membership.length} members, ${t.forms.length} forms, ${t.views.length} views.`)),e&&c.append(M("div",{class:"danger-banner",id:"restore-error"},e)),!!ut.plan){for(const i of ut.plan.notes)c.append(M("div",{class:"warnings"},i));Kt(wt())&&c.append(M("div",{class:"danger-banner"},`This connection (${wt().conn.name}) looks like Production.`)),c.append(ut.plan.ops.length?M("ol",{class:"ops",id:"restore-ops"},...ut.plan.ops.map(nn)):Lt("Nothing to restore","The environment already matches the backup."))}}async function sr(){var s;const e=Wt();if(!e||!(ut!=null&&ut.plan))return;const c=ut.plan,t=await Ne(e,c.solution.id).catch(()=>null);if(!t||t.isManaged){await _t("Refused",`${c.solution.uniqueName} is managed (or could not be read). Nothing was written.`,"error");return}if(!await dn({title:"Apply restore",body:M("p",{},`${c.ops.length} operations on ${c.solution.uniqueName} in ${((s=wt())==null?void 0:s.conn.name)??""}.`),okLabel:`Apply ${c.ops.length}`,danger:Kt(wt())}))return;const i=await je(e,c.ops,t.uniqueName,(o,p)=>Et(o<p?`Restoring ${o+1} / ${p}…`:null));Et(null);for(const o of c.ops)o.kind==="update-form"&&se().delete(Rt(it.Form,o.edit.form.id)),o.kind==="update-view"&&se().delete(Rt(it.View,o.edit.view.id));const r=i.filter(o=>!o.ok&&!o.skipped).length;await _t(r?"Restore incomplete":"Restored",`${i.length-r} ok, ${r} failed`,r?"error":"success"),ut.plan=null,Vt(),K("#restore-results").replaceChildren(M("h3",{},"Restore results"),sn(i))}async function an(e,c){const t=K("#offline-body");try{ar(await Gn(e,c,ke(),jt))}catch(u){t.replaceChildren(M("div",{class:"danger-banner"},u.message))}}function ar(e){const c=e.groups.filter(i=>i.status==="blocker").length,t=i=>`${i.typeName} ${Ot(i)}${i.parentSchemaName?` (${i.parentSchemaName})`:""}`,u=e.groups.map(i=>M("li",{class:`finding${i.status==="safe"?" is-safe":""}`},M("div",{class:"head"},pt(i.dependent.typeName,"neutral"),M("span",{class:"name mono"},Ot(i.dependent)),i.dependent.parentSchemaName?M("span",{class:"caption"},i.dependent.parentSchemaName):null,pt(i.status==="blocker"?"blocker":"present in target",i.status==="blocker"?"bad":"ok")),M("div",{class:"chips"},...i.required.map(r=>M("span",{class:`req${r.safe?" is-safe":""}`},M("span",{class:"sol"},r.solution??"unknown solution"),t(r))))));K("#offline-body").replaceChildren(M("div",{class:"summary",id:"offline-summary"},M("strong",{},`${e.uniqueName} ${e.version}`),e.managed?pt("managed","neutral"):pt("unmanaged","neutral"),`${e.total} missing dependencies in solution.xml ·`,pt(`${e.groups.length} dependents in scope`,"neutral"),pt(`${c} blocking`,c?"bad":"ok")),e.groups.length?M("ul",{class:"findings"},...u):Lt("No missing dependencies in scope",`Filter: ${ke().join(", ")}`))}function lr(){const e=K("#drop");e.addEventListener("dragover",c=>{c.preventDefault(),e.classList.add("is-over")}),e.addEventListener("dragleave",()=>e.classList.remove("is-over")),e.addEventListener("drop",async c=>{var u,i;c.preventDefault(),e.classList.remove("is-over");const t=(i=(u=c.dataTransfer)==null?void 0:u.files)==null?void 0:i[0];t&&await an(t.name,new Uint8Array(await t.arrayBuffer()))}),K("#btn-open-zip").addEventListener("click",async()=>{const[c]=await Jn({title:"Open solution zip",extensions:["zip"]});c&&await an(c.name,c.data)})}async function ln(e,c,t){await Ge(e,c,t)&&await _t("Exported",e,"success")}function cr(){fn(),K("#btn-run").addEventListener("click",()=>void tn()),K("#btn-cancel").addEventListener("click",()=>{ve=!0}),K("#show-safe").addEventListener("change",ae),K("#btn-to-fix").addEventListener("click",()=>void nr()),K("#btn-backup").addEventListener("click",()=>void rr()),K("#prod-ack").addEventListener("change",Se),K("#btn-confirm").addEventListener("click",()=>void ir()),K("#btn-load-backup").addEventListener("click",()=>void or()),K("#btn-restore-apply").addEventListener("click",()=>void sr()),K("#btn-export-json").addEventListener("click",()=>{rt&&ln(`dependency-findings.${qe(rt.solution.uniqueName)}.json`,qn(rt),"application/json")}),K("#btn-export-csv").addEventListener("click",()=>{rt&&ln(`dependency-findings.${qe(rt.solution.uniqueName)}.csv`,Pn(rt),"text/csv")}),lr(),Vn(()=>void Qe().then(ae)),K("#host-mode").textContent=He()?"Running inside Power Platform ToolBox":"Standalone mode (Offline tab only)"}Xn(e=>document.documentElement.setAttribute("data-theme",e)),cr(),ae(),le(),Vt(),Qe()})();
|