@nextcloud/files 3.0.0-beta.22 → 3.0.0-beta.23

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.
@@ -25,6 +25,15 @@
25
25
  *
26
26
  * @param size in bytes
27
27
  * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead
28
- * @param binaryPrefixes True if binary prefixes like `KiB` should be used (size base 2)
28
+ * @param binaryPrefixes True if size base 2 (and binary prefixes like `KiB`) should be used
29
29
  */
30
30
  export declare function formatFileSize(size: number | string, skipSmallSizes?: boolean, binaryPrefixes?: boolean): string;
31
+ /**
32
+ * Returns a file size in bytes from a humanly readable string
33
+ * Note: `b` and `B` are both parsed as bytes and not as bit or byte.
34
+ *
35
+ * @param {string} value file size in human-readable format
36
+ * @param {boolean} forceBinary for backwards compatibility this allows values to be base 2 (so 2KB means 2048 bytes instead of 2000 bytes)
37
+ * @return {number} or null if string could not be parsed
38
+ */
39
+ export declare function parseFileSize(value: string, forceBinary?: boolean): number | null;
package/dist/index.cjs CHANGED
@@ -1,28 +1,28 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@nextcloud/auth"),X=require("@nextcloud/logger"),gt=require("@nextcloud/l10n"),b=require("path"),mt=require("@nextcloud/router"),H=require("webdav"),wt=require("webdav/dist/node/request.js"),vt=t=>t===null?X.getLoggerBuilder().setApp("files").build():X.getLoggerBuilder().setApp("files").setUid(t.uid).build(),w=vt(_.getCurrentUser());class yt{_entries=[];registerEntry(e){this.validateEntry(e),this._entries.push(e)}unregisterEntry(e){const i=typeof e=="string"?this.getEntryIndex(e):this.getEntryIndex(e.id);if(i===-1){w.warn("Entry not found, nothing removed",{entry:e,entries:this.getEntries()});return}this._entries.splice(i,1)}getEntries(e){return e?this._entries.filter(i=>typeof i.if=="function"?i.if(e):!0):this._entries}getEntryIndex(e){return this._entries.findIndex(i=>i.id===e)}validateEntry(e){if(!e.id||!e.displayName||!(e.iconSvgInline||e.iconClass||e.handler))throw new Error("Invalid entry");if(typeof e.id!="string"||typeof e.displayName!="string")throw new Error("Invalid id or displayName property");if(e.iconClass&&typeof e.iconClass!="string"||e.iconSvgInline&&typeof e.iconSvgInline!="string")throw new Error("Invalid icon provided");if(e.if!==void 0&&typeof e.if!="function")throw new Error("Invalid if property");if(e.templateName&&typeof e.templateName!="string")throw new Error("Invalid templateName property");if(e.handler&&typeof e.handler!="function")throw new Error("Invalid handler property");if(!e.templateName&&!e.handler)throw new Error("At least a templateName or a handler must be provided");if(this.getEntryIndex(e.id)!==-1)throw new Error("Duplicate entry")}}const $=function(){return typeof window._nc_newfilemenu>"u"&&(window._nc_newfilemenu=new yt,w.debug("NewFileMenu initialized")),window._nc_newfilemenu},C=["B","KB","MB","GB","TB","PB"],D=["B","KiB","MiB","GiB","TiB","PiB"];function bt(t,e=!1,i=!1){typeof t=="string"&&(t=Number(t));let s=t>0?Math.floor(Math.log(t)/Math.log(i?1024:1e3)):0;s=Math.min((i?D.length:C.length)-1,s);const n=i?D[s]:C[s];let r=(t/Math.pow(i?1024:1e3,s)).toFixed(1);return e===!0&&s===0?(r!=="0.0"?"< 1 ":"0 ")+(i?D[1]:C[1]):(s<2?r=parseFloat(r).toFixed(0):r=parseFloat(r).toLocaleString(gt.getCanonicalLocale()),r+" "+n)}var k=(t=>(t.DEFAULT="default",t.HIDDEN="hidden",t))(k||{});class xt{_action;constructor(e){this.validateAction(e),this._action=e}get id(){return this._action.id}get displayName(){return this._action.displayName}get title(){return this._action.title}get iconSvgInline(){return this._action.iconSvgInline}get enabled(){return this._action.enabled}get exec(){return this._action.exec}get execBatch(){return this._action.execBatch}get order(){return this._action.order}get default(){return this._action.default}get inline(){return this._action.inline}get renderInline(){return this._action.renderInline}validateAction(e){if(!e.id||typeof e.id!="string")throw new Error("Invalid id");if(!e.displayName||typeof e.displayName!="function")throw new Error("Invalid displayName function");if("title"in e&&typeof e.title!="function")throw new Error("Invalid title function");if(!e.iconSvgInline||typeof e.iconSvgInline!="function")throw new Error("Invalid iconSvgInline function");if(!e.exec||typeof e.exec!="function")throw new Error("Invalid exec function");if("enabled"in e&&typeof e.enabled!="function")throw new Error("Invalid enabled function");if("execBatch"in e&&typeof e.execBatch!="function")throw new Error("Invalid execBatch function");if("order"in e&&typeof e.order!="number")throw new Error("Invalid order");if(e.default&&!Object.values(k).includes(e.default))throw new Error("Invalid default");if("inline"in e&&typeof e.inline!="function")throw new Error("Invalid inline function");if("renderInline"in e&&typeof e.renderInline!="function")throw new Error("Invalid renderInline function")}}const Et=function(t){if(typeof window._nc_fileactions>"u"&&(window._nc_fileactions=[],w.debug("FileActions initialized")),window._nc_fileactions.find(e=>e.id===t.id)){w.error(`FileAction ${t.id} already registered`,{action:t});return}window._nc_fileactions.push(t)},Nt=function(){return typeof window._nc_fileactions>"u"&&(window._nc_fileactions=[],w.debug("FileActions initialized")),window._nc_fileactions};class _t{_header;constructor(e){this.validateHeader(e),this._header=e}get id(){return this._header.id}get order(){return this._header.order}get enabled(){return this._header.enabled}get render(){return this._header.render}get updated(){return this._header.updated}validateHeader(e){if(!e.id||!e.render||!e.updated)throw new Error("Invalid header: id, render and updated are required");if(typeof e.id!="string")throw new Error("Invalid id property");if(e.enabled!==void 0&&typeof e.enabled!="function")throw new Error("Invalid enabled property");if(e.render&&typeof e.render!="function")throw new Error("Invalid render property");if(e.updated&&typeof e.updated!="function")throw new Error("Invalid updated property")}}const At=function(t){if(typeof window._nc_filelistheader>"u"&&(window._nc_filelistheader=[],w.debug("FileListHeaders initialized")),window._nc_filelistheader.find(e=>e.id===t.id)){w.error(`Header ${t.id} already registered`,{header:t});return}window._nc_filelistheader.push(t)},Tt=function(){return typeof window._nc_filelistheader>"u"&&(window._nc_filelistheader=[],w.debug("FileListHeaders initialized")),window._nc_filelistheader};var m=(t=>(t[t.NONE=0]="NONE",t[t.CREATE=4]="CREATE",t[t.READ=1]="READ",t[t.UPDATE=2]="UPDATE",t[t.DELETE=8]="DELETE",t[t.SHARE=16]="SHARE",t[t.ALL=31]="ALL",t))(m||{});const L=["d:getcontentlength","d:getcontenttype","d:getetag","d:getlastmodified","d:quota-available-bytes","d:resourcetype","nc:has-preview","nc:is-encrypted","nc:mount-type","nc:share-attributes","oc:comments-unread","oc:favorite","oc:fileid","oc:owner-display-name","oc:owner-id","oc:permissions","oc:share-types","oc:size","ocs:share-permissions"],R={d:"DAV:",nc:"http://nextcloud.org/ns",oc:"http://owncloud.org/ns",ocs:"http://open-collaboration-services.org/ns"},It=function(t,e={nc:"http://nextcloud.org/ns"}){typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...L],window._nc_dav_namespaces={...R});const i={...window._nc_dav_namespaces,...e};if(window._nc_dav_properties.find(n=>n===t))return w.error(`${t} already registered`,{prop:t}),!1;if(t.startsWith("<")||t.split(":").length!==2)return w.error(`${t} is not valid. See example: 'oc:fileid'`,{prop:t}),!1;const s=t.split(":")[0];return i[s]?(window._nc_dav_properties.push(t),window._nc_dav_namespaces=i,!0):(w.error(`${t} namespace unknown`,{prop:t,namespaces:i}),!1)},T=function(){return typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...L]),window._nc_dav_properties.map(t=>`<${t} />`).join(" ")},I=function(){return typeof window._nc_dav_namespaces>"u"&&(window._nc_dav_namespaces={...R}),Object.keys(window._nc_dav_namespaces).map(t=>`xmlns:${t}="${window._nc_dav_namespaces?.[t]}"`).join(" ")},Ot=function(){return`<?xml version="1.0"?>
2
- <d:propfind ${I()}>
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@nextcloud/auth"),H=require("@nextcloud/logger"),gt=require("@nextcloud/l10n"),b=require("path"),mt=require("@nextcloud/router"),K=require("webdav"),wt=require("webdav/dist/node/request.js"),vt=t=>t===null?H.getLoggerBuilder().setApp("files").build():H.getLoggerBuilder().setApp("files").setUid(t.uid).build(),w=vt(A.getCurrentUser());class yt{_entries=[];registerEntry(e){this.validateEntry(e),this._entries.push(e)}unregisterEntry(e){const i=typeof e=="string"?this.getEntryIndex(e):this.getEntryIndex(e.id);if(i===-1){w.warn("Entry not found, nothing removed",{entry:e,entries:this.getEntries()});return}this._entries.splice(i,1)}getEntries(e){return e?this._entries.filter(i=>typeof i.if=="function"?i.if(e):!0):this._entries}getEntryIndex(e){return this._entries.findIndex(i=>i.id===e)}validateEntry(e){if(!e.id||!e.displayName||!(e.iconSvgInline||e.iconClass||e.handler))throw new Error("Invalid entry");if(typeof e.id!="string"||typeof e.displayName!="string")throw new Error("Invalid id or displayName property");if(e.iconClass&&typeof e.iconClass!="string"||e.iconSvgInline&&typeof e.iconSvgInline!="string")throw new Error("Invalid icon provided");if(e.if!==void 0&&typeof e.if!="function")throw new Error("Invalid if property");if(e.templateName&&typeof e.templateName!="string")throw new Error("Invalid templateName property");if(e.handler&&typeof e.handler!="function")throw new Error("Invalid handler property");if(!e.templateName&&!e.handler)throw new Error("At least a templateName or a handler must be provided");if(this.getEntryIndex(e.id)!==-1)throw new Error("Duplicate entry")}}const k=function(){return typeof window._nc_newfilemenu>"u"&&(window._nc_newfilemenu=new yt,w.debug("NewFileMenu initialized")),window._nc_newfilemenu},D=["B","KB","MB","GB","TB","PB"],S=["B","KiB","MiB","GiB","TiB","PiB"];function bt(t,e=!1,i=!0){typeof t=="string"&&(t=Number(t));let r=t>0?Math.floor(Math.log(t)/Math.log(i?1024:1e3)):0;r=Math.min((i?S.length:D.length)-1,r);const n=i?S[r]:D[r];let s=(t/Math.pow(i?1024:1e3,r)).toFixed(1);return e===!0&&r===0?(s!=="0.0"?"< 1 ":"0 ")+(i?S[1]:D[1]):(r<2?s=parseFloat(s).toFixed(0):s=parseFloat(s).toLocaleString(gt.getCanonicalLocale()),s+" "+n)}var L=(t=>(t.DEFAULT="default",t.HIDDEN="hidden",t))(L||{});class xt{_action;constructor(e){this.validateAction(e),this._action=e}get id(){return this._action.id}get displayName(){return this._action.displayName}get title(){return this._action.title}get iconSvgInline(){return this._action.iconSvgInline}get enabled(){return this._action.enabled}get exec(){return this._action.exec}get execBatch(){return this._action.execBatch}get order(){return this._action.order}get default(){return this._action.default}get inline(){return this._action.inline}get renderInline(){return this._action.renderInline}validateAction(e){if(!e.id||typeof e.id!="string")throw new Error("Invalid id");if(!e.displayName||typeof e.displayName!="function")throw new Error("Invalid displayName function");if("title"in e&&typeof e.title!="function")throw new Error("Invalid title function");if(!e.iconSvgInline||typeof e.iconSvgInline!="function")throw new Error("Invalid iconSvgInline function");if(!e.exec||typeof e.exec!="function")throw new Error("Invalid exec function");if("enabled"in e&&typeof e.enabled!="function")throw new Error("Invalid enabled function");if("execBatch"in e&&typeof e.execBatch!="function")throw new Error("Invalid execBatch function");if("order"in e&&typeof e.order!="number")throw new Error("Invalid order");if(e.default&&!Object.values(L).includes(e.default))throw new Error("Invalid default");if("inline"in e&&typeof e.inline!="function")throw new Error("Invalid inline function");if("renderInline"in e&&typeof e.renderInline!="function")throw new Error("Invalid renderInline function")}}const Et=function(t){if(typeof window._nc_fileactions>"u"&&(window._nc_fileactions=[],w.debug("FileActions initialized")),window._nc_fileactions.find(e=>e.id===t.id)){w.error(`FileAction ${t.id} already registered`,{action:t});return}window._nc_fileactions.push(t)},Nt=function(){return typeof window._nc_fileactions>"u"&&(window._nc_fileactions=[],w.debug("FileActions initialized")),window._nc_fileactions};class _t{_header;constructor(e){this.validateHeader(e),this._header=e}get id(){return this._header.id}get order(){return this._header.order}get enabled(){return this._header.enabled}get render(){return this._header.render}get updated(){return this._header.updated}validateHeader(e){if(!e.id||!e.render||!e.updated)throw new Error("Invalid header: id, render and updated are required");if(typeof e.id!="string")throw new Error("Invalid id property");if(e.enabled!==void 0&&typeof e.enabled!="function")throw new Error("Invalid enabled property");if(e.render&&typeof e.render!="function")throw new Error("Invalid render property");if(e.updated&&typeof e.updated!="function")throw new Error("Invalid updated property")}}const At=function(t){if(typeof window._nc_filelistheader>"u"&&(window._nc_filelistheader=[],w.debug("FileListHeaders initialized")),window._nc_filelistheader.find(e=>e.id===t.id)){w.error(`Header ${t.id} already registered`,{header:t});return}window._nc_filelistheader.push(t)},Tt=function(){return typeof window._nc_filelistheader>"u"&&(window._nc_filelistheader=[],w.debug("FileListHeaders initialized")),window._nc_filelistheader};var m=(t=>(t[t.NONE=0]="NONE",t[t.CREATE=4]="CREATE",t[t.READ=1]="READ",t[t.UPDATE=2]="UPDATE",t[t.DELETE=8]="DELETE",t[t.SHARE=16]="SHARE",t[t.ALL=31]="ALL",t))(m||{});const R=["d:getcontentlength","d:getcontenttype","d:getetag","d:getlastmodified","d:quota-available-bytes","d:resourcetype","nc:has-preview","nc:is-encrypted","nc:mount-type","nc:share-attributes","oc:comments-unread","oc:favorite","oc:fileid","oc:owner-display-name","oc:owner-id","oc:permissions","oc:share-types","oc:size","ocs:share-permissions"],j={d:"DAV:",nc:"http://nextcloud.org/ns",oc:"http://owncloud.org/ns",ocs:"http://open-collaboration-services.org/ns"},It=function(t,e={nc:"http://nextcloud.org/ns"}){typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...R],window._nc_dav_namespaces={...j});const i={...window._nc_dav_namespaces,...e};if(window._nc_dav_properties.find(n=>n===t))return w.error(`${t} already registered`,{prop:t}),!1;if(t.startsWith("<")||t.split(":").length!==2)return w.error(`${t} is not valid. See example: 'oc:fileid'`,{prop:t}),!1;const r=t.split(":")[0];return i[r]?(window._nc_dav_properties.push(t),window._nc_dav_namespaces=i,!0):(w.error(`${t} namespace unknown`,{prop:t,namespaces:i}),!1)},I=function(){return typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...R]),window._nc_dav_properties.map(t=>`<${t} />`).join(" ")},O=function(){return typeof window._nc_dav_namespaces>"u"&&(window._nc_dav_namespaces={...j}),Object.keys(window._nc_dav_namespaces).map(t=>`xmlns:${t}="${window._nc_dav_namespaces?.[t]}"`).join(" ")},Ot=function(){return`<?xml version="1.0"?>
2
+ <d:propfind ${O()}>
3
3
  <d:prop>
4
- ${T()}
4
+ ${I()}
5
5
  </d:prop>
6
- </d:propfind>`},et=function(){return`<?xml version="1.0"?>
7
- <oc:filter-files ${I()}>
6
+ </d:propfind>`},it=function(){return`<?xml version="1.0"?>
7
+ <oc:filter-files ${O()}>
8
8
  <d:prop>
9
- ${T()}
9
+ ${I()}
10
10
  </d:prop>
11
11
  <oc:filter-rules>
12
12
  <oc:favorite>1</oc:favorite>
13
13
  </oc:filter-rules>
14
14
  </oc:filter-files>`},Pt=function(t){return`<?xml version="1.0" encoding="UTF-8"?>
15
- <d:searchrequest ${I()}
15
+ <d:searchrequest ${O()}
16
16
  xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
17
17
  <d:basicsearch>
18
18
  <d:select>
19
19
  <d:prop>
20
- ${T()}
20
+ ${I()}
21
21
  </d:prop>
22
22
  </d:select>
23
23
  <d:from>
24
24
  <d:scope>
25
- <d:href>/files/${_.getCurrentUser()?.uid}/</d:href>
25
+ <d:href>/files/${A.getCurrentUser()?.uid}/</d:href>
26
26
  <d:depth>infinity</d:depth>
27
27
  </d:scope>
28
28
  </d:from>
@@ -65,10 +65,10 @@
65
65
  <ns:firstresult>0</ns:firstresult>
66
66
  </d:limit>
67
67
  </d:basicsearch>
68
- </d:searchrequest>`},it=function(t=""){let e=m.NONE;return t&&((t.includes("C")||t.includes("K"))&&(e|=m.CREATE),t.includes("G")&&(e|=m.READ),(t.includes("W")||t.includes("N")||t.includes("V"))&&(e|=m.UPDATE),t.includes("D")&&(e|=m.DELETE),t.includes("R")&&(e|=m.SHARE)),e};var O=(t=>(t.Folder="folder",t.File="file",t))(O||{});const nt=function(t,e){return t.match(e)!==null},K=(t,e)=>{if(t.id&&typeof t.id!="number")throw new Error("Invalid id type of value");if(!t.source)throw new Error("Missing mandatory source");try{new URL(t.source)}catch{throw new Error("Invalid source format, source must be a valid URL")}if(!t.source.startsWith("http"))throw new Error("Invalid source format, only http(s) is supported");if(t.mtime&&!(t.mtime instanceof Date))throw new Error("Invalid mtime type");if(t.crtime&&!(t.crtime instanceof Date))throw new Error("Invalid crtime type");if(!t.mime||typeof t.mime!="string"||!t.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))throw new Error("Missing or invalid mandatory mime");if("size"in t&&typeof t.size!="number"&&t.size!==void 0)throw new Error("Invalid size type");if("permissions"in t&&t.permissions!==void 0&&!(typeof t.permissions=="number"&&t.permissions>=m.NONE&&t.permissions<=m.ALL))throw new Error("Invalid permissions");if(t.owner&&t.owner!==null&&typeof t.owner!="string")throw new Error("Invalid owner type");if(t.attributes&&typeof t.attributes!="object")throw new Error("Invalid attributes type");if(t.root&&typeof t.root!="string")throw new Error("Invalid root type");if(t.root&&!t.root.startsWith("/"))throw new Error("Root must start with a leading slash");if(t.root&&!t.source.includes(t.root))throw new Error("Root must be part of the source");if(t.root&&nt(t.source,e)){const i=t.source.match(e)[0];if(!t.source.includes(b.join(i,t.root)))throw new Error("The root must be relative to the service. e.g /files/emma")}if(t.status&&!Object.values(j).includes(t.status))throw new Error("Status must be a valid NodeStatus")};var j=(t=>(t.NEW="new",t.FAILED="failed",t.LOADING="loading",t.LOCKED="locked",t))(j||{});class M{_data;_attributes;_knownDavService=/(remote|public)\.php\/(web)?dav/i;constructor(e,i){K(e,i||this._knownDavService),this._data=e;const s={set:(n,r,l)=>(this.updateMtime(),Reflect.set(n,r,l)),deleteProperty:(n,r)=>(this.updateMtime(),Reflect.deleteProperty(n,r))};this._attributes=new Proxy(e.attributes||{},s),delete this._data.attributes,i&&(this._knownDavService=i)}get source(){return this._data.source.replace(/\/$/i,"")}get basename(){return b.basename(this.source)}get extension(){return b.extname(this.source)}get dirname(){if(this.root){const i=this.source.indexOf(this.root);return b.dirname(this.source.slice(i+this.root.length)||"/")}const e=new URL(this.source);return b.dirname(e.pathname)}get mime(){return this._data.mime}get mtime(){return this._data.mtime}get crtime(){return this._data.crtime}get size(){return this._data.size}get attributes(){return this._attributes}get permissions(){return this.owner===null&&!this.isDavRessource?m.READ:this._data.permissions!==void 0?this._data.permissions:m.NONE}get owner(){return this.isDavRessource?this._data.owner:null}get isDavRessource(){return nt(this.source,this._knownDavService)}get root(){return this._data.root?this._data.root.replace(/^(.+)\/$/,"$1"):this.isDavRessource&&b.dirname(this.source).split(this._knownDavService).pop()||null}get path(){if(this.root){const e=this.source.indexOf(this.root);return this.source.slice(e+this.root.length)||"/"}return(this.dirname+"/"+this.basename).replace(/\/\//g,"/")}get fileid(){return this._data?.id||this.attributes?.fileid}get status(){return this._data?.status}set status(e){this._data.status=e}move(e){K({...this._data,source:e},this._knownDavService),this._data.source=e,this.updateMtime()}rename(e){if(e.includes("/"))throw new Error("Invalid basename");this.move(b.dirname(this.source)+"/"+e)}updateMtime(){this._data.mtime&&(this._data.mtime=new Date)}}class rt extends M{get type(){return O.File}}class st extends M{constructor(e){super({...e,mime:"httpd/unix-directory"})}get type(){return O.Folder}get extension(){return null}get mime(){return"httpd/unix-directory"}}const B=`/files/${_.getCurrentUser()?.uid}`,q=mt.generateRemoteUrl("dav"),Ct=function(t=q){const e=H.createClient(t,{headers:{requesttoken:_.getRequestToken()||""}});return H.getPatcher().patch("request",i=>(i.headers?.method&&(i.method=i.headers.method,delete i.headers.method),wt.request(i))),e},Dt=async(t,e="/",i=B)=>(await t.getDirectoryContents(`${i}${e}`,{details:!0,data:et(),headers:{method:"REPORT"},includeSelf:!0})).data.filter(s=>s.filename!==e).map(s=>ot(s,i)),ot=function(t,e=B,i=q){const s=t.props,n=it(s?.permissions),r=_.getCurrentUser()?.uid,l={id:s?.fileid||0,source:`${i}${t.filename}`,mtime:new Date(Date.parse(t.lastmod)),mime:t.mime,size:s?.size||Number.parseInt(s.getcontentlength||"0"),permissions:n,owner:r,root:e,attributes:{...t,...s,hasPreview:s?.["has-preview"]}};return delete l.attributes?.props,t.type==="file"?new rt(l):new st(l)};class at{_views=[];_currentView=null;register(e){if(this._views.find(i=>i.id===e.id))throw new Error(`View id ${e.id} is already registered`);this._views.push(e)}remove(e){const i=this._views.findIndex(s=>s.id===e);i!==-1&&this._views.splice(i,1)}get views(){return this._views}setActive(e){this._currentView=e}get active(){return this._currentView}}const St=function(){return typeof window._nc_navigation>"u"&&(window._nc_navigation=new at,w.debug("Navigation service initialized")),window._nc_navigation};class lt{_column;constructor(e){Ft(e),this._column=e}get id(){return this._column.id}get title(){return this._column.title}get render(){return this._column.render}get sort(){return this._column.sort}get summary(){return this._column.summary}}const Ft=function(t){if(!t.id||typeof t.id!="string")throw new Error("A column id is required");if(!t.title||typeof t.title!="string")throw new Error("A column title is required");if(!t.render||typeof t.render!="function")throw new Error("A render function is required");if(t.sort&&typeof t.sort!="function")throw new Error("Column sortFunction must be a function");if(t.summary&&typeof t.summary!="function")throw new Error("Column summary must be a function");return!0};var U={},P={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",s="["+e+"]["+i+"]*",n=new RegExp("^"+s+"$"),r=function(o,a){const d=[];let u=a.exec(o);for(;u;){const h=[];h.startIndex=a.lastIndex-u[0].length;const c=u.length;for(let f=0;f<c;f++)h.push(u[f]);d.push(h),u=a.exec(o)}return d},l=function(o){const a=n.exec(o);return!(a===null||typeof a>"u")};t.isExist=function(o){return typeof o<"u"},t.isEmptyObject=function(o){return Object.keys(o).length===0},t.merge=function(o,a,d){if(a){const u=Object.keys(a),h=u.length;for(let c=0;c<h;c++)d==="strict"?o[u[c]]=[a[u[c]]]:o[u[c]]=a[u[c]]}},t.getValue=function(o){return t.isExist(o)?o:""},t.isName=l,t.getAllMatches=r,t.nameRegexp=s})(P);const z=P,Vt={allowBooleanAttributes:!1,unpairedTags:[]};U.validate=function(t,e){e=Object.assign({},Vt,e);const i=[];let s=!1,n=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let r=0;r<t.length;r++)if(t[r]==="<"&&t[r+1]==="?"){if(r+=2,r=Y(t,r),r.err)return r}else if(t[r]==="<"){let l=r;if(r++,t[r]==="!"){r=Z(t,r);continue}else{let o=!1;t[r]==="/"&&(o=!0,r++);let a="";for(;r<t.length&&t[r]!==">"&&t[r]!==" "&&t[r]!==" "&&t[r]!==`
69
- `&&t[r]!=="\r";r++)a+=t[r];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),r--),!qt(a)){let h;return a.trim().length===0?h="Invalid space after '<'.":h="Tag '"+a+"' is an invalid name.",p("InvalidTag",h,g(t,r))}const d=Lt(t,r);if(d===!1)return p("InvalidAttr","Attributes for '"+a+"' have open quote.",g(t,r));let u=d.value;if(r=d.index,u[u.length-1]==="/"){const h=r-u.length;u=u.substring(0,u.length-1);const c=J(u,e);if(c===!0)s=!0;else return p(c.err.code,c.err.msg,g(t,h+c.err.line))}else if(o)if(d.tagClosed){if(u.trim().length>0)return p("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",g(t,l));{const h=i.pop();if(a!==h.tagName){let c=g(t,h.tagStartPos);return p("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+c.line+", col "+c.col+") instead of closing tag '"+a+"'.",g(t,l))}i.length==0&&(n=!0)}}else return p("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",g(t,r));else{const h=J(u,e);if(h!==!0)return p(h.err.code,h.err.msg,g(t,r-u.length+h.err.line));if(n===!0)return p("InvalidXml","Multiple possible root nodes found.",g(t,r));e.unpairedTags.indexOf(a)!==-1||i.push({tagName:a,tagStartPos:l}),s=!0}for(r++;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="!"){r++,r=Z(t,r);continue}else if(t[r+1]==="?"){if(r=Y(t,++r),r.err)return r}else break;else if(t[r]==="&"){const h=Mt(t,r);if(h==-1)return p("InvalidChar","char '&' is not expected.",g(t,r));r=h}else if(n===!0&&!W(t[r]))return p("InvalidXml","Extra text at the end",g(t,r));t[r]==="<"&&r--}}else{if(W(t[r]))continue;return p("InvalidChar","char '"+t[r]+"' is not expected.",g(t,r))}if(s){if(i.length==1)return p("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",g(t,i[0].tagStartPos));if(i.length>0)return p("InvalidXml","Invalid '"+JSON.stringify(i.map(r=>r.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return p("InvalidXml","Start tag expected.",1);return!0};function W(t){return t===" "||t===" "||t===`
70
- `||t==="\r"}function Y(t,e){const i=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const s=t.substr(i,e-i);if(e>5&&s==="xml")return p("InvalidXml","XML declaration allowed only at the start of the document.",g(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Z(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let i=1;for(e+=8;e<t.length;e++)if(t[e]==="<")i++;else if(t[e]===">"&&(i--,i===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const $t='"',kt="'";function Lt(t,e){let i="",s="",n=!1;for(;e<t.length;e++){if(t[e]===$t||t[e]===kt)s===""?s=t[e]:s!==t[e]||(s="");else if(t[e]===">"&&s===""){n=!0;break}i+=t[e]}return s!==""?!1:{value:i,index:e,tagClosed:n}}const Rt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function J(t,e){const i=z.getAllMatches(t,Rt),s={};for(let n=0;n<i.length;n++){if(i[n][1].length===0)return p("InvalidAttr","Attribute '"+i[n][2]+"' has no space in starting.",E(i[n]));if(i[n][3]!==void 0&&i[n][4]===void 0)return p("InvalidAttr","Attribute '"+i[n][2]+"' is without value.",E(i[n]));if(i[n][3]===void 0&&!e.allowBooleanAttributes)return p("InvalidAttr","boolean attribute '"+i[n][2]+"' is not allowed.",E(i[n]));const r=i[n][2];if(!Bt(r))return p("InvalidAttr","Attribute '"+r+"' is an invalid name.",E(i[n]));if(!s.hasOwnProperty(r))s[r]=1;else return p("InvalidAttr","Attribute '"+r+"' is repeated.",E(i[n]))}return!0}function jt(t,e){let i=/\d/;for(t[e]==="x"&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(i))break}return-1}function Mt(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,jt(t,e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(t[e]===";")break;return-1}return e}function p(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function Bt(t){return z.isName(t)}function qt(t){return z.isName(t)}function g(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function E(t){return t.startIndex+t[1].length}var S={};const dt={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t}},Ut=function(t){return Object.assign({},dt,t)};S.buildOptions=Ut,S.defaultOptions=dt;class zt{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,i){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:i})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Gt=zt;const Xt=P;function Ht(t,e){const i={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let s=1,n=!1,r=!1,l="";for(;e<t.length;e++)if(t[e]==="<"&&!r){if(n&&Yt(t,e))e+=7,[entityName,val,e]=Kt(t,e+1),val.indexOf("&")===-1&&(i[te(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(n&&Zt(t,e))e+=8;else if(n&&Jt(t,e))e+=8;else if(n&&Qt(t,e))e+=9;else if(Wt)r=!0;else throw new Error("Invalid DOCTYPE");s++,l=""}else if(t[e]===">"){if(r?t[e-1]==="-"&&t[e-2]==="-"&&(r=!1,s--):s--,s===0)break}else t[e]==="["?n=!0:l+=t[e];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:i,i:e}}function Kt(t,e){let i="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)i+=t[e];if(i=i.trim(),i.indexOf(" ")!==-1)throw new Error("External entites are not supported");const s=t[e++];let n="";for(;e<t.length&&t[e]!==s;e++)n+=t[e];return[i,n,e]}function Wt(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Yt(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function Zt(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function Jt(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function Qt(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function te(t){if(Xt.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var ee=Ht;const ie=/^[-+]?0x[a-fA-F0-9]+$/,ne=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const re={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function se(t,e={}){if(e=Object.assign({},re,e),!t||typeof t!="string")return t;let i=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(i))return t;if(e.hex&&ie.test(i))return Number.parseInt(i,16);{const s=ne.exec(i);if(s){const n=s[1],r=s[2];let l=oe(s[3]);const o=s[4]||s[6];if(!e.leadingZeros&&r.length>0&&n&&i[2]!=="."||!e.leadingZeros&&r.length>0&&!n&&i[1]!==".")return t;{const a=Number(i),d=""+a;return d.search(/[eE]/)!==-1||o?e.eNotation?a:t:i.indexOf(".")!==-1?d==="0"&&l===""||d===l||n&&d==="-"+l?a:t:r?l===d||n+l===d?a:t:i===d||i===n+d?a:t}}else return t}}function oe(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}var ae=se;const G=P,N=Gt,le=ee,de=ae;"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,G.nameRegexp);let ue=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"}},this.addExternalEntities=ce,this.parseXml=me,this.parseTextData=he,this.resolveNameSpace=pe,this.buildAttributesMap=ge,this.isItStopNode=be,this.replaceEntitiesValue=ve,this.readStopNodeData=Ee,this.saveTextToParentTag=ye,this.addChild=we}};function ce(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:t[s]}}}function he(t,e,i,s,n,r,l){if(t!==void 0&&(this.options.trimValues&&!s&&(t=t.trim()),t.length>0)){l||(t=this.replaceEntitiesValue(t));const o=this.options.tagValueProcessor(e,t,i,n,r);return o==null?t:typeof o!=typeof t||o!==t?o:this.options.trimValues?V(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?V(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function pe(t){if(this.options.removeNSPrefix){const e=t.split(":"),i=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=i+e[1])}return t}const fe=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function ge(t,e,i){if(!this.options.ignoreAttributes&&typeof t=="string"){const s=G.getAllMatches(t,fe),n=s.length,r={};for(let l=0;l<n;l++){const o=this.resolveNameSpace(s[l][1]);let a=s[l][4],d=this.options.attributeNamePrefix+o;if(o.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);const u=this.options.attributeValueProcessor(o,a,e);u==null?r[d]=a:typeof u!=typeof a||u!==a?r[d]=u:r[d]=V(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(r[d]=!0)}if(!Object.keys(r).length)return;if(this.options.attributesGroupName){const l={};return l[this.options.attributesGroupName]=r,l}return r}}const me=function(t){t=t.replace(/\r\n?/g,`
71
- `);const e=new N("!xml");let i=e,s="",n="";for(let r=0;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){const l=x(t,">",r,"Closing Tag is not closed.");let o=t.substring(r+2,l).trim();if(this.options.removeNSPrefix){const u=o.indexOf(":");u!==-1&&(o=o.substr(u+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(s=this.saveTextToParentTag(s,i,n));const a=n.substring(n.lastIndexOf(".")+1);if(o&&this.options.unpairedTags.indexOf(o)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let d=0;a&&this.options.unpairedTags.indexOf(a)!==-1?(d=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=n.lastIndexOf("."),n=n.substring(0,d),i=this.tagsNodeStack.pop(),s="",r=l}else if(t[r+1]==="?"){let l=F(t,r,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,n),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const o=new N(l.tagName);o.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(o[":@"]=this.buildAttributesMap(l.tagExp,n,l.tagName)),this.addChild(i,o,n)}r=l.closeIndex+1}else if(t.substr(r+1,3)==="!--"){const l=x(t,"-->",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=t.substring(r+4,l-2);s=this.saveTextToParentTag(s,i,n),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=l}else if(t.substr(r+1,2)==="!D"){const l=le(t,r);this.docTypeEntities=l.entities,r=l.i}else if(t.substr(r+1,2)==="!["){const l=x(t,"]]>",r,"CDATA is not closed.")-2,o=t.substring(r+9,l);if(s=this.saveTextToParentTag(s,i,n),this.options.cdataPropName)i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]);else{let a=this.parseTextData(o,i.tagname,n,!0,!1,!0);a==null&&(a=""),i.add(this.options.textNodeName,a)}r=l+2}else{let l=F(t,r,this.options.removeNSPrefix),o=l.tagName,a=l.tagExp,d=l.attrExpPresent,u=l.closeIndex;this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&s&&i.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,i,n,!1));const h=i;if(h&&this.options.unpairedTags.indexOf(h.tagname)!==-1&&(i=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),o!==e.tagname&&(n+=n?"."+o:o),this.isItStopNode(this.options.stopNodes,n,o)){let c="";if(a.length>0&&a.lastIndexOf("/")===a.length-1)r=l.closeIndex;else if(this.options.unpairedTags.indexOf(o)!==-1)r=l.closeIndex;else{const v=this.readStopNodeData(t,o,u+1);if(!v)throw new Error(`Unexpected end of ${o}`);r=v.i,c=v.tagContent}const f=new N(o);o!==a&&d&&(f[":@"]=this.buildAttributesMap(a,n,o)),c&&(c=this.parseTextData(c,o,n,!0,d,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),f.add(this.options.textNodeName,c),this.addChild(i,f,n)}else{if(a.length>0&&a.lastIndexOf("/")===a.length-1){o[o.length-1]==="/"?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),a=o):a=a.substr(0,a.length-1),this.options.transformTagName&&(o=this.options.transformTagName(o));const c=new N(o);o!==a&&d&&(c[":@"]=this.buildAttributesMap(a,n,o)),this.addChild(i,c,n),n=n.substr(0,n.lastIndexOf("."))}else{const c=new N(o);this.tagsNodeStack.push(i),o!==a&&d&&(c[":@"]=this.buildAttributesMap(a,n,o)),this.addChild(i,c,n),i=c}s="",r=u}}else s+=t[r];return e.child};function we(t,e,i){const s=this.options.updateTag(e.tagname,i,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),t.addChild(e))}const ve=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const i=this.docTypeEntities[e];t=t.replace(i.regx,i.val)}for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function ye(t,e,i,s){return t&&(s===void 0&&(s=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,i,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,s),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function be(t,e,i){const s="*."+i;for(const n in t){const r=t[n];if(s===r||e===r)return!0}return!1}function xe(t,e,i=">"){let s,n="";for(let r=e;r<t.length;r++){let l=t[r];if(s)l===s&&(s="");else if(l==='"'||l==="'")s=l;else if(l===i[0])if(i[1]){if(t[r+1]===i[1])return{data:n,index:r}}else return{data:n,index:r};else l===" "&&(l=" ");n+=l}}function x(t,e,i,s){const n=t.indexOf(e,i);if(n===-1)throw new Error(s);return n+e.length-1}function F(t,e,i,s=">"){const n=xe(t,e+1,s);if(!n)return;let r=n.data;const l=n.index,o=r.search(/\s/);let a=r,d=!0;if(o!==-1&&(a=r.substr(0,o).replace(/\s\s*$/,""),r=r.substr(o+1)),i){const u=a.indexOf(":");u!==-1&&(a=a.substr(u+1),d=a!==n.data.substr(u+1))}return{tagName:a,tagExp:r,closeIndex:l,attrExpPresent:d}}function Ee(t,e,i){const s=i;let n=1;for(;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){const r=x(t,">",i,`${e} is not closed`);if(t.substring(i+2,r).trim()===e&&(n--,n===0))return{tagContent:t.substring(s,i),i:r};i=r}else if(t[i+1]==="?")i=x(t,"?>",i+1,"StopNode is not closed.");else if(t.substr(i+1,3)==="!--")i=x(t,"-->",i+3,"StopNode is not closed.");else if(t.substr(i+1,2)==="![")i=x(t,"]]>",i,"StopNode is not closed.")-2;else{const r=F(t,i,">");r&&((r&&r.tagName)===e&&r.tagExp[r.tagExp.length-1]!=="/"&&n++,i=r.closeIndex)}}function V(t,e,i){if(e&&typeof t=="string"){const s=t.trim();return s==="true"?!0:s==="false"?!1:de(t,i)}else return G.isExist(t)?t:""}var Ne=ue,ut={};function _e(t,e){return ct(t,e)}function ct(t,e,i){let s;const n={};for(let r=0;r<t.length;r++){const l=t[r],o=Ae(l);let a="";if(i===void 0?a=o:a=i+"."+o,o===e.textNodeName)s===void 0?s=l[o]:s+=""+l[o];else{if(o===void 0)continue;if(l[o]){let d=ct(l[o],e,a);const u=Ie(d,e);l[":@"]?Te(d,l[":@"],a,e):Object.keys(d).length===1&&d[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?d=d[e.textNodeName]:Object.keys(d).length===0&&(e.alwaysCreateTextNode?d[e.textNodeName]="":d=""),n[o]!==void 0&&n.hasOwnProperty(o)?(Array.isArray(n[o])||(n[o]=[n[o]]),n[o].push(d)):e.isArray(o,a,u)?n[o]=[d]:n[o]=d}}}return typeof s=="string"?s.length>0&&(n[e.textNodeName]=s):s!==void 0&&(n[e.textNodeName]=s),n}function Ae(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];if(s!==":@")return s}}function Te(t,e,i,s){if(e){const n=Object.keys(e),r=n.length;for(let l=0;l<r;l++){const o=n[l];s.isArray(o,i+"."+o,!0,!0)?t[o]=[e[o]]:t[o]=e[o]}}}function Ie(t,e){const{textNodeName:i}=e,s=Object.keys(t).length;return!!(s===0||s===1&&(t[i]||typeof t[i]=="boolean"||t[i]===0))}ut.prettify=_e;const{buildOptions:Oe}=S,Pe=Ne,{prettify:Ce}=ut,De=U;let Se=class{constructor(t){this.externalEntities={},this.options=Oe(t)}parse(t,e){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(e){e===!0&&(e={});const n=De.validate(t,e);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const i=new Pe(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(t);return this.options.preserveOrder||s===void 0?s:Ce(s,this.options)}addEntity(t,e){if(e.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(e==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}};var Fe=Se;const Ve=`
72
- `;function $e(t,e){let i="";return e.format&&e.indentBy.length>0&&(i=Ve),ht(t,e,"",i)}function ht(t,e,i,s){let n="",r=!1;for(let l=0;l<t.length;l++){const o=t[l],a=ke(o);let d="";if(i.length===0?d=a:d=`${i}.${a}`,a===e.textNodeName){let v=o[a];Le(d,e)||(v=e.tagValueProcessor(a,v),v=pt(v,e)),r&&(n+=s),n+=v,r=!1;continue}else if(a===e.cdataPropName){r&&(n+=s),n+=`<![CDATA[${o[a][0][e.textNodeName]}]]>`,r=!1;continue}else if(a===e.commentPropName){n+=s+`<!--${o[a][0][e.textNodeName]}-->`,r=!0;continue}else if(a[0]==="?"){const v=Q(o[":@"],e),ft=a==="?xml"?"":s;let A=o[a][0][e.textNodeName];A=A.length!==0?" "+A:"",n+=ft+`<${a}${A}${v}?>`,r=!0;continue}let u=s;u!==""&&(u+=e.indentBy);const h=Q(o[":@"],e),c=s+`<${a}${h}`,f=ht(o[a],e,d,u);e.unpairedTags.indexOf(a)!==-1?e.suppressUnpairedNode?n+=c+">":n+=c+"/>":(!f||f.length===0)&&e.suppressEmptyNode?n+=c+"/>":f&&f.endsWith(">")?n+=c+`>${f}${s}</${a}>`:(n+=c+">",f&&s!==""&&(f.includes("/>")||f.includes("</"))?n+=s+e.indentBy+f+s:n+=f,n+=`</${a}>`),r=!0}return n}function ke(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];if(s!==":@")return s}}function Q(t,e){let i="";if(t&&!e.ignoreAttributes)for(let s in t){let n=e.attributeValueProcessor(s,t[s]);n=pt(n,e),n===!0&&e.suppressBooleanAttributes?i+=` ${s.substr(e.attributeNamePrefix.length)}`:i+=` ${s.substr(e.attributeNamePrefix.length)}="${n}"`}return i}function Le(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let i=t.substr(t.lastIndexOf(".")+1);for(let s in e.stopNodes)if(e.stopNodes[s]===t||e.stopNodes[s]==="*."+i)return!0;return!1}function pt(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const s=e.entities[i];t=t.replace(s.regex,s.val)}return t}var Re=$e;const je=Re,Me={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function y(t){this.options=Object.assign({},Me,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ue),this.processTextOrObjNode=Be,this.options.format?(this.indentate=qe,this.tagEndChar=`>
68
+ </d:searchrequest>`},nt=function(t=""){let e=m.NONE;return t&&((t.includes("C")||t.includes("K"))&&(e|=m.CREATE),t.includes("G")&&(e|=m.READ),(t.includes("W")||t.includes("N")||t.includes("V"))&&(e|=m.UPDATE),t.includes("D")&&(e|=m.DELETE),t.includes("R")&&(e|=m.SHARE)),e};var P=(t=>(t.Folder="folder",t.File="file",t))(P||{});const rt=function(t,e){return t.match(e)!==null},W=(t,e)=>{if(t.id&&typeof t.id!="number")throw new Error("Invalid id type of value");if(!t.source)throw new Error("Missing mandatory source");try{new URL(t.source)}catch{throw new Error("Invalid source format, source must be a valid URL")}if(!t.source.startsWith("http"))throw new Error("Invalid source format, only http(s) is supported");if(t.mtime&&!(t.mtime instanceof Date))throw new Error("Invalid mtime type");if(t.crtime&&!(t.crtime instanceof Date))throw new Error("Invalid crtime type");if(!t.mime||typeof t.mime!="string"||!t.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))throw new Error("Missing or invalid mandatory mime");if("size"in t&&typeof t.size!="number"&&t.size!==void 0)throw new Error("Invalid size type");if("permissions"in t&&t.permissions!==void 0&&!(typeof t.permissions=="number"&&t.permissions>=m.NONE&&t.permissions<=m.ALL))throw new Error("Invalid permissions");if(t.owner&&t.owner!==null&&typeof t.owner!="string")throw new Error("Invalid owner type");if(t.attributes&&typeof t.attributes!="object")throw new Error("Invalid attributes type");if(t.root&&typeof t.root!="string")throw new Error("Invalid root type");if(t.root&&!t.root.startsWith("/"))throw new Error("Root must start with a leading slash");if(t.root&&!t.source.includes(t.root))throw new Error("Root must be part of the source");if(t.root&&rt(t.source,e)){const i=t.source.match(e)[0];if(!t.source.includes(b.join(i,t.root)))throw new Error("The root must be relative to the service. e.g /files/emma")}if(t.status&&!Object.values(M).includes(t.status))throw new Error("Status must be a valid NodeStatus")};var M=(t=>(t.NEW="new",t.FAILED="failed",t.LOADING="loading",t.LOCKED="locked",t))(M||{});class B{_data;_attributes;_knownDavService=/(remote|public)\.php\/(web)?dav/i;constructor(e,i){W(e,i||this._knownDavService),this._data=e;const r={set:(n,s,a)=>(this.updateMtime(),Reflect.set(n,s,a)),deleteProperty:(n,s)=>(this.updateMtime(),Reflect.deleteProperty(n,s))};this._attributes=new Proxy(e.attributes||{},r),delete this._data.attributes,i&&(this._knownDavService=i)}get source(){return this._data.source.replace(/\/$/i,"")}get basename(){return b.basename(this.source)}get extension(){return b.extname(this.source)}get dirname(){if(this.root){const i=this.source.indexOf(this.root);return b.dirname(this.source.slice(i+this.root.length)||"/")}const e=new URL(this.source);return b.dirname(e.pathname)}get mime(){return this._data.mime}get mtime(){return this._data.mtime}get crtime(){return this._data.crtime}get size(){return this._data.size}get attributes(){return this._attributes}get permissions(){return this.owner===null&&!this.isDavRessource?m.READ:this._data.permissions!==void 0?this._data.permissions:m.NONE}get owner(){return this.isDavRessource?this._data.owner:null}get isDavRessource(){return rt(this.source,this._knownDavService)}get root(){return this._data.root?this._data.root.replace(/^(.+)\/$/,"$1"):this.isDavRessource&&b.dirname(this.source).split(this._knownDavService).pop()||null}get path(){if(this.root){const e=this.source.indexOf(this.root);return this.source.slice(e+this.root.length)||"/"}return(this.dirname+"/"+this.basename).replace(/\/\//g,"/")}get fileid(){return this._data?.id||this.attributes?.fileid}get status(){return this._data?.status}set status(e){this._data.status=e}move(e){W({...this._data,source:e},this._knownDavService),this._data.source=e,this.updateMtime()}rename(e){if(e.includes("/"))throw new Error("Invalid basename");this.move(b.dirname(this.source)+"/"+e)}updateMtime(){this._data.mtime&&(this._data.mtime=new Date)}}class st extends B{get type(){return P.File}}class ot extends B{constructor(e){super({...e,mime:"httpd/unix-directory"})}get type(){return P.Folder}get extension(){return null}get mime(){return"httpd/unix-directory"}}const q=`/files/${A.getCurrentUser()?.uid}`,U=mt.generateRemoteUrl("dav"),Ct=function(t=U){const e=K.createClient(t,{headers:{requesttoken:A.getRequestToken()||""}});return K.getPatcher().patch("request",i=>(i.headers?.method&&(i.method=i.headers.method,delete i.headers.method),wt.request(i))),e},Dt=async(t,e="/",i=q)=>(await t.getDirectoryContents(`${i}${e}`,{details:!0,data:it(),headers:{method:"REPORT"},includeSelf:!0})).data.filter(r=>r.filename!==e).map(r=>at(r,i)),at=function(t,e=q,i=U){const r=t.props,n=nt(r?.permissions),s=A.getCurrentUser()?.uid,a={id:r?.fileid||0,source:`${i}${t.filename}`,mtime:new Date(Date.parse(t.lastmod)),mime:t.mime,size:r?.size||Number.parseInt(r.getcontentlength||"0"),permissions:n,owner:s,root:e,attributes:{...t,...r,hasPreview:r?.["has-preview"]}};return delete a.attributes?.props,t.type==="file"?new st(a):new ot(a)};class lt{_views=[];_currentView=null;register(e){if(this._views.find(i=>i.id===e.id))throw new Error(`View id ${e.id} is already registered`);this._views.push(e)}remove(e){const i=this._views.findIndex(r=>r.id===e);i!==-1&&this._views.splice(i,1)}get views(){return this._views}setActive(e){this._currentView=e}get active(){return this._currentView}}const St=function(){return typeof window._nc_navigation>"u"&&(window._nc_navigation=new lt,w.debug("Navigation service initialized")),window._nc_navigation};class dt{_column;constructor(e){Ft(e),this._column=e}get id(){return this._column.id}get title(){return this._column.title}get render(){return this._column.render}get sort(){return this._column.sort}get summary(){return this._column.summary}}const Ft=function(t){if(!t.id||typeof t.id!="string")throw new Error("A column id is required");if(!t.title||typeof t.title!="string")throw new Error("A column title is required");if(!t.render||typeof t.render!="function")throw new Error("A render function is required");if(t.sort&&typeof t.sort!="function")throw new Error("Column sortFunction must be a function");if(t.summary&&typeof t.summary!="function")throw new Error("Column summary must be a function");return!0};var z={},C={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+i+"]*",n=new RegExp("^"+r+"$"),s=function(o,l){const d=[];let u=l.exec(o);for(;u;){const c=[];c.startIndex=l.lastIndex-u[0].length;const p=u.length;for(let h=0;h<p;h++)c.push(u[h]);d.push(c),u=l.exec(o)}return d},a=function(o){const l=n.exec(o);return!(l===null||typeof l>"u")};t.isExist=function(o){return typeof o<"u"},t.isEmptyObject=function(o){return Object.keys(o).length===0},t.merge=function(o,l,d){if(l){const u=Object.keys(l),c=u.length;for(let p=0;p<c;p++)d==="strict"?o[u[p]]=[l[u[p]]]:o[u[p]]=l[u[p]]}},t.getValue=function(o){return t.isExist(o)?o:""},t.isName=a,t.getAllMatches=s,t.nameRegexp=r})(C);const G=C,Vt={allowBooleanAttributes:!1,unpairedTags:[]};z.validate=function(t,e){e=Object.assign({},Vt,e);const i=[];let r=!1,n=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=Z(t,s),s.err)return s}else if(t[s]==="<"){let a=s;if(s++,t[s]==="!"){s=J(t,s);continue}else{let o=!1;t[s]==="/"&&(o=!0,s++);let l="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
69
+ `&&t[s]!=="\r";s++)l+=t[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!qt(l)){let c;return l.trim().length===0?c="Invalid space after '<'.":c="Tag '"+l+"' is an invalid name.",f("InvalidTag",c,g(t,s))}const d=Lt(t,s);if(d===!1)return f("InvalidAttr","Attributes for '"+l+"' have open quote.",g(t,s));let u=d.value;if(s=d.index,u[u.length-1]==="/"){const c=s-u.length;u=u.substring(0,u.length-1);const p=Q(u,e);if(p===!0)r=!0;else return f(p.err.code,p.err.msg,g(t,c+p.err.line))}else if(o)if(d.tagClosed){if(u.trim().length>0)return f("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",g(t,a));{const c=i.pop();if(l!==c.tagName){let p=g(t,c.tagStartPos);return f("InvalidTag","Expected closing tag '"+c.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+l+"'.",g(t,a))}i.length==0&&(n=!0)}}else return f("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",g(t,s));else{const c=Q(u,e);if(c!==!0)return f(c.err.code,c.err.msg,g(t,s-u.length+c.err.line));if(n===!0)return f("InvalidXml","Multiple possible root nodes found.",g(t,s));e.unpairedTags.indexOf(l)!==-1||i.push({tagName:l,tagStartPos:a}),r=!0}for(s++;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="!"){s++,s=J(t,s);continue}else if(t[s+1]==="?"){if(s=Z(t,++s),s.err)return s}else break;else if(t[s]==="&"){const c=Mt(t,s);if(c==-1)return f("InvalidChar","char '&' is not expected.",g(t,s));s=c}else if(n===!0&&!Y(t[s]))return f("InvalidXml","Extra text at the end",g(t,s));t[s]==="<"&&s--}}else{if(Y(t[s]))continue;return f("InvalidChar","char '"+t[s]+"' is not expected.",g(t,s))}if(r){if(i.length==1)return f("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",g(t,i[0].tagStartPos));if(i.length>0)return f("InvalidXml","Invalid '"+JSON.stringify(i.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return f("InvalidXml","Start tag expected.",1);return!0};function Y(t){return t===" "||t===" "||t===`
70
+ `||t==="\r"}function Z(t,e){const i=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(i,e-i);if(e>5&&r==="xml")return f("InvalidXml","XML declaration allowed only at the start of the document.",g(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function J(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let i=1;for(e+=8;e<t.length;e++)if(t[e]==="<")i++;else if(t[e]===">"&&(i--,i===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const $t='"',kt="'";function Lt(t,e){let i="",r="",n=!1;for(;e<t.length;e++){if(t[e]===$t||t[e]===kt)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){n=!0;break}i+=t[e]}return r!==""?!1:{value:i,index:e,tagClosed:n}}const Rt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Q(t,e){const i=G.getAllMatches(t,Rt),r={};for(let n=0;n<i.length;n++){if(i[n][1].length===0)return f("InvalidAttr","Attribute '"+i[n][2]+"' has no space in starting.",N(i[n]));if(i[n][3]!==void 0&&i[n][4]===void 0)return f("InvalidAttr","Attribute '"+i[n][2]+"' is without value.",N(i[n]));if(i[n][3]===void 0&&!e.allowBooleanAttributes)return f("InvalidAttr","boolean attribute '"+i[n][2]+"' is not allowed.",N(i[n]));const s=i[n][2];if(!Bt(s))return f("InvalidAttr","Attribute '"+s+"' is an invalid name.",N(i[n]));if(!r.hasOwnProperty(s))r[s]=1;else return f("InvalidAttr","Attribute '"+s+"' is repeated.",N(i[n]))}return!0}function jt(t,e){let i=/\d/;for(t[e]==="x"&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(i))break}return-1}function Mt(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,jt(t,e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(t[e]===";")break;return-1}return e}function f(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function Bt(t){return G.isName(t)}function qt(t){return G.isName(t)}function g(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function N(t){return t.startIndex+t[1].length}var F={};const ut={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t}},Ut=function(t){return Object.assign({},ut,t)};F.buildOptions=Ut,F.defaultOptions=ut;class zt{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,i){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:i})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Gt=zt;const Xt=C;function Ht(t,e){const i={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let r=1,n=!1,s=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!s){if(n&&Yt(t,e))e+=7,[entityName,val,e]=Kt(t,e+1),val.indexOf("&")===-1&&(i[te(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(n&&Zt(t,e))e+=8;else if(n&&Jt(t,e))e+=8;else if(n&&Qt(t,e))e+=9;else if(Wt)s=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[e]===">"){if(s?t[e-1]==="-"&&t[e-2]==="-"&&(s=!1,r--):r--,r===0)break}else t[e]==="["?n=!0:a+=t[e];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:i,i:e}}function Kt(t,e){let i="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)i+=t[e];if(i=i.trim(),i.indexOf(" ")!==-1)throw new Error("External entites are not supported");const r=t[e++];let n="";for(;e<t.length&&t[e]!==r;e++)n+=t[e];return[i,n,e]}function Wt(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Yt(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function Zt(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function Jt(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function Qt(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function te(t){if(Xt.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var ee=Ht;const ie=/^[-+]?0x[a-fA-F0-9]+$/,ne=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const re={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function se(t,e={}){if(e=Object.assign({},re,e),!t||typeof t!="string")return t;let i=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(i))return t;if(e.hex&&ie.test(i))return Number.parseInt(i,16);{const r=ne.exec(i);if(r){const n=r[1],s=r[2];let a=oe(r[3]);const o=r[4]||r[6];if(!e.leadingZeros&&s.length>0&&n&&i[2]!=="."||!e.leadingZeros&&s.length>0&&!n&&i[1]!==".")return t;{const l=Number(i),d=""+l;return d.search(/[eE]/)!==-1||o?e.eNotation?l:t:i.indexOf(".")!==-1?d==="0"&&a===""||d===a||n&&d==="-"+a?l:t:s?a===d||n+a===d?l:t:i===d||i===n+d?l:t}}else return t}}function oe(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}var ae=se;const X=C,_=Gt,le=ee,de=ae;"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,X.nameRegexp);let ue=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"}},this.addExternalEntities=ce,this.parseXml=me,this.parseTextData=he,this.resolveNameSpace=pe,this.buildAttributesMap=ge,this.isItStopNode=be,this.replaceEntitiesValue=ve,this.readStopNodeData=Ee,this.saveTextToParentTag=ye,this.addChild=we}};function ce(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const r=e[i];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:t[r]}}}function he(t,e,i,r,n,s,a){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));const o=this.options.tagValueProcessor(e,t,i,n,s);return o==null?t:typeof o!=typeof t||o!==t?o:this.options.trimValues?$(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?$(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function pe(t){if(this.options.removeNSPrefix){const e=t.split(":"),i=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=i+e[1])}return t}const fe=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function ge(t,e,i){if(!this.options.ignoreAttributes&&typeof t=="string"){const r=X.getAllMatches(t,fe),n=r.length,s={};for(let a=0;a<n;a++){const o=this.resolveNameSpace(r[a][1]);let l=r[a][4],d=this.options.attributeNamePrefix+o;if(o.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const u=this.options.attributeValueProcessor(o,l,e);u==null?s[d]=l:typeof u!=typeof l||u!==l?s[d]=u:s[d]=$(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[d]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const me=function(t){t=t.replace(/\r\n?/g,`
71
+ `);const e=new _("!xml");let i=e,r="",n="";for(let s=0;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="/"){const a=x(t,">",s,"Closing Tag is not closed.");let o=t.substring(s+2,a).trim();if(this.options.removeNSPrefix){const u=o.indexOf(":");u!==-1&&(o=o.substr(u+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(r=this.saveTextToParentTag(r,i,n));const l=n.substring(n.lastIndexOf(".")+1);if(o&&this.options.unpairedTags.indexOf(o)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let d=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(d=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=n.lastIndexOf("."),n=n.substring(0,d),i=this.tagsNodeStack.pop(),r="",s=a}else if(t[s+1]==="?"){let a=V(t,s,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,i,n),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const o=new _(a.tagName);o.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(o[":@"]=this.buildAttributesMap(a.tagExp,n,a.tagName)),this.addChild(i,o,n)}s=a.closeIndex+1}else if(t.substr(s+1,3)==="!--"){const a=x(t,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const o=t.substring(s+4,a-2);r=this.saveTextToParentTag(r,i,n),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}s=a}else if(t.substr(s+1,2)==="!D"){const a=le(t,s);this.docTypeEntities=a.entities,s=a.i}else if(t.substr(s+1,2)==="!["){const a=x(t,"]]>",s,"CDATA is not closed.")-2,o=t.substring(s+9,a);if(r=this.saveTextToParentTag(r,i,n),this.options.cdataPropName)i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]);else{let l=this.parseTextData(o,i.tagname,n,!0,!1,!0);l==null&&(l=""),i.add(this.options.textNodeName,l)}s=a+2}else{let a=V(t,s,this.options.removeNSPrefix),o=a.tagName;const l=a.rawTagName;let d=a.tagExp,u=a.attrExpPresent,c=a.closeIndex;this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&r&&i.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,i,n,!1));const p=i;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(i=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),o!==e.tagname&&(n+=n?"."+o:o),this.isItStopNode(this.options.stopNodes,n,o)){let h="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)s=a.closeIndex;else if(this.options.unpairedTags.indexOf(o)!==-1)s=a.closeIndex;else{const E=this.readStopNodeData(t,l,c+1);if(!E)throw new Error(`Unexpected end of ${l}`);s=E.i,h=E.tagContent}const v=new _(o);o!==d&&u&&(v[":@"]=this.buildAttributesMap(d,n,o)),h&&(h=this.parseTextData(h,o,n,!0,u,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),v.add(this.options.textNodeName,h),this.addChild(i,v,n)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){o[o.length-1]==="/"?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),d=o):d=d.substr(0,d.length-1),this.options.transformTagName&&(o=this.options.transformTagName(o));const h=new _(o);o!==d&&u&&(h[":@"]=this.buildAttributesMap(d,n,o)),this.addChild(i,h,n),n=n.substr(0,n.lastIndexOf("."))}else{const h=new _(o);this.tagsNodeStack.push(i),o!==d&&u&&(h[":@"]=this.buildAttributesMap(d,n,o)),this.addChild(i,h,n),i=h}r="",s=c}}else r+=t[s];return e.child};function we(t,e,i){const r=this.options.updateTag(e.tagname,i,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),t.addChild(e))}const ve=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const i=this.docTypeEntities[e];t=t.replace(i.regx,i.val)}for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function ye(t,e,i,r){return t&&(r===void 0&&(r=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,i,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function be(t,e,i){const r="*."+i;for(const n in t){const s=t[n];if(r===s||e===s)return!0}return!1}function xe(t,e,i=">"){let r,n="";for(let s=e;s<t.length;s++){let a=t[s];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===i[0])if(i[1]){if(t[s+1]===i[1])return{data:n,index:s}}else return{data:n,index:s};else a===" "&&(a=" ");n+=a}}function x(t,e,i,r){const n=t.indexOf(e,i);if(n===-1)throw new Error(r);return n+e.length-1}function V(t,e,i,r=">"){const n=xe(t,e+1,r);if(!n)return;let s=n.data;const a=n.index,o=s.search(/\s/);let l=s,d=!0;o!==-1&&(l=s.substr(0,o).replace(/\s\s*$/,""),s=s.substr(o+1));const u=l;if(i){const c=l.indexOf(":");c!==-1&&(l=l.substr(c+1),d=l!==n.data.substr(c+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:d,rawTagName:u}}function Ee(t,e,i){const r=i;let n=1;for(;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){const s=x(t,">",i,`${e} is not closed`);if(t.substring(i+2,s).trim()===e&&(n--,n===0))return{tagContent:t.substring(r,i),i:s};i=s}else if(t[i+1]==="?")i=x(t,"?>",i+1,"StopNode is not closed.");else if(t.substr(i+1,3)==="!--")i=x(t,"-->",i+3,"StopNode is not closed.");else if(t.substr(i+1,2)==="![")i=x(t,"]]>",i,"StopNode is not closed.")-2;else{const s=V(t,i,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&n++,i=s.closeIndex)}}function $(t,e,i){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:de(t,i)}else return X.isExist(t)?t:""}var Ne=ue,ct={};function _e(t,e){return ht(t,e)}function ht(t,e,i){let r;const n={};for(let s=0;s<t.length;s++){const a=t[s],o=Ae(a);let l="";if(i===void 0?l=o:l=i+"."+o,o===e.textNodeName)r===void 0?r=a[o]:r+=""+a[o];else{if(o===void 0)continue;if(a[o]){let d=ht(a[o],e,l);const u=Ie(d,e);a[":@"]?Te(d,a[":@"],l,e):Object.keys(d).length===1&&d[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?d=d[e.textNodeName]:Object.keys(d).length===0&&(e.alwaysCreateTextNode?d[e.textNodeName]="":d=""),n[o]!==void 0&&n.hasOwnProperty(o)?(Array.isArray(n[o])||(n[o]=[n[o]]),n[o].push(d)):e.isArray(o,l,u)?n[o]=[d]:n[o]=d}}}return typeof r=="string"?r.length>0&&(n[e.textNodeName]=r):r!==void 0&&(n[e.textNodeName]=r),n}function Ae(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const r=e[i];if(r!==":@")return r}}function Te(t,e,i,r){if(e){const n=Object.keys(e),s=n.length;for(let a=0;a<s;a++){const o=n[a];r.isArray(o,i+"."+o,!0,!0)?t[o]=[e[o]]:t[o]=e[o]}}}function Ie(t,e){const{textNodeName:i}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[i]||typeof t[i]=="boolean"||t[i]===0))}ct.prettify=_e;const{buildOptions:Oe}=F,Pe=Ne,{prettify:Ce}=ct,De=z;let Se=class{constructor(t){this.externalEntities={},this.options=Oe(t)}parse(t,e){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(e){e===!0&&(e={});const n=De.validate(t,e);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const i=new Pe(this.options);i.addExternalEntities(this.externalEntities);const r=i.parseXml(t);return this.options.preserveOrder||r===void 0?r:Ce(r,this.options)}addEntity(t,e){if(e.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(e==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}};var Fe=Se;const Ve=`
72
+ `;function $e(t,e){let i="";return e.format&&e.indentBy.length>0&&(i=Ve),pt(t,e,"",i)}function pt(t,e,i,r){let n="",s=!1;for(let a=0;a<t.length;a++){const o=t[a],l=ke(o);if(l===void 0)continue;let d="";if(i.length===0?d=l:d=`${i}.${l}`,l===e.textNodeName){let v=o[l];Le(d,e)||(v=e.tagValueProcessor(l,v),v=ft(v,e)),s&&(n+=r),n+=v,s=!1;continue}else if(l===e.cdataPropName){s&&(n+=r),n+=`<![CDATA[${o[l][0][e.textNodeName]}]]>`,s=!1;continue}else if(l===e.commentPropName){n+=r+`<!--${o[l][0][e.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const v=tt(o[":@"],e),E=l==="?xml"?"":r;let T=o[l][0][e.textNodeName];T=T.length!==0?" "+T:"",n+=E+`<${l}${T}${v}?>`,s=!0;continue}let u=r;u!==""&&(u+=e.indentBy);const c=tt(o[":@"],e),p=r+`<${l}${c}`,h=pt(o[l],e,d,u);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?n+=p+">":n+=p+"/>":(!h||h.length===0)&&e.suppressEmptyNode?n+=p+"/>":h&&h.endsWith(">")?n+=p+`>${h}${r}</${l}>`:(n+=p+">",h&&r!==""&&(h.includes("/>")||h.includes("</"))?n+=r+e.indentBy+h+r:n+=h,n+=`</${l}>`),s=!0}return n}function ke(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const r=e[i];if(t.hasOwnProperty(r)&&r!==":@")return r}}function tt(t,e){let i="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let n=e.attributeValueProcessor(r,t[r]);n=ft(n,e),n===!0&&e.suppressBooleanAttributes?i+=` ${r.substr(e.attributeNamePrefix.length)}`:i+=` ${r.substr(e.attributeNamePrefix.length)}="${n}"`}return i}function Le(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let i=t.substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+i)return!0;return!1}function ft(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const r=e.entities[i];t=t.replace(r.regex,r.val)}return t}var Re=$e;const je=Re,Me={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function y(t){this.options=Object.assign({},Me,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ue),this.processTextOrObjNode=Be,this.options.format?(this.indentate=qe,this.tagEndChar=`>
73
73
  `,this.newLine=`
74
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}y.prototype.build=function(t){return this.options.preserveOrder?je(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},y.prototype.j2x=function(t,e){let i="",s="";for(let n in t)if(typeof t[n]>"u")this.isAttribute(n)&&(s+="");else if(t[n]===null)this.isAttribute(n)?s+="":n[0]==="?"?s+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+n+"/"+this.tagEndChar;else if(t[n]instanceof Date)s+=this.buildTextValNode(t[n],n,"",e);else if(typeof t[n]!="object"){const r=this.isAttribute(n);if(r)i+=this.buildAttrPairStr(r,""+t[n]);else if(n===this.options.textNodeName){let l=this.options.tagValueProcessor(n,""+t[n]);s+=this.replaceEntitiesValue(l)}else s+=this.buildTextValNode(t[n],n,"",e)}else if(Array.isArray(t[n])){const r=t[n].length;let l="";for(let o=0;o<r;o++){const a=t[n][o];typeof a>"u"||(a===null?n[0]==="?"?s+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+n+"/"+this.tagEndChar:typeof a=="object"?this.options.oneListGroup?l+=this.j2x(a,e+1).val:l+=this.processTextOrObjNode(a,n,e):l+=this.buildTextValNode(a,n,"",e))}this.options.oneListGroup&&(l=this.buildObjectNode(l,n,"",e)),s+=l}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){const r=Object.keys(t[n]),l=r.length;for(let o=0;o<l;o++)i+=this.buildAttrPairStr(r[o],""+t[n][r[o]])}else s+=this.processTextOrObjNode(t[n],n,e);return{attrStr:i,val:s}},y.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Be(t,e,i){const s=this.j2x(t,i+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,i):this.buildObjectNode(s.val,e,s.attrStr,i)}y.prototype.buildObjectNode=function(t,e,i,s){if(t==="")return e[0]==="?"?this.indentate(s)+"<"+e+i+"?"+this.tagEndChar:this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,r="";return e[0]==="?"&&(r="?",n=""),(i||i==="")&&t.indexOf("<")===-1?this.indentate(s)+"<"+e+i+r+">"+t+n:this.options.commentPropName!==!1&&e===this.options.commentPropName&&r.length===0?this.indentate(s)+`<!--${t}-->`+this.newLine:this.indentate(s)+"<"+e+i+r+this.tagEndChar+t+this.indentate(s)+n}},y.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e},y.prototype.buildTextValNode=function(t,e,i,s){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(s)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(s)+"<"+e+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),n===""?this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+i+">"+n+"</"+e+this.tagEndChar}},y.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};function qe(t){return this.options.indentBy.repeat(t)}function Ue(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var ze=y;const Ge=U,Xe=Fe,He=ze;var tt={XMLParser:Xe,XMLValidator:Ge,XMLBuilder:He};function Ke(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);if(t=t.trim(),t.length===0||tt.XMLValidator.validate(t)!==!0)return!1;let e;const i=new tt.XMLParser;try{e=i.parse(t)}catch{return!1}return!(!e||!("svg"in e))}class We{_view;constructor(e){Ye(e),this._view=e}get id(){return this._view.id}get name(){return this._view.name}get caption(){return this._view.caption}get emptyTitle(){return this._view.emptyTitle}get emptyCaption(){return this._view.emptyCaption}get getContents(){return this._view.getContents}get icon(){return this._view.icon}set icon(e){this._view.icon=e}get order(){return this._view.order}set order(e){this._view.order=e}get params(){return this._view.params}set params(e){this._view.params=e}get columns(){return this._view.columns}get emptyView(){return this._view.emptyView}get parent(){return this._view.parent}get sticky(){return this._view.sticky}get expanded(){return this._view.expanded}set expanded(e){this._view.expanded=e}get defaultSortKey(){return this._view.defaultSortKey}}const Ye=function(t){if(!t.id||typeof t.id!="string")throw new Error("View id is required and must be a string");if(!t.name||typeof t.name!="string")throw new Error("View name is required and must be a string");if(t.columns&&t.columns.length>0&&(!t.caption||typeof t.caption!="string"))throw new Error("View caption is required for top-level views and must be a string");if(!t.getContents||typeof t.getContents!="function")throw new Error("View getContents is required and must be a function");if(!t.icon||typeof t.icon!="string"||!Ke(t.icon))throw new Error("View icon is required and must be a valid svg string");if(!("order"in t)||typeof t.order!="number")throw new Error("View order is required and must be a number");if(t.columns&&t.columns.forEach(e=>{if(!(e instanceof lt))throw new Error("View columns must be an array of Column. Invalid column found")}),t.emptyView&&typeof t.emptyView!="function")throw new Error("View emptyView must be a function");if(t.parent&&typeof t.parent!="string")throw new Error("View parent must be a string");if("sticky"in t&&typeof t.sticky!="boolean")throw new Error("View sticky must be a boolean");if("expanded"in t&&typeof t.expanded!="boolean")throw new Error("View expanded must be a boolean");if(t.defaultSortKey&&typeof t.defaultSortKey!="string")throw new Error("View defaultSortKey must be a string");return!0},Ze=function(t){return $().registerEntry(t)},Je=function(t){return $().unregisterEntry(t)},Qe=function(t){return $().getEntries(t)};exports.Column=lt,exports.DefaultType=k,exports.File=rt,exports.FileAction=xt,exports.FileType=O,exports.Folder=st,exports.Header=_t,exports.Navigation=at,exports.Node=M,exports.NodeStatus=j,exports.Permission=m,exports.View=We,exports.addNewFileMenuEntry=Ze,exports.davGetClient=Ct,exports.davGetDefaultPropfind=Ot,exports.davGetFavoritesReport=et,exports.davGetRecentSearch=Pt,exports.davParsePermissions=it,exports.davRemoteURL=q,exports.davResultToNode=ot,exports.davRootPath=B,exports.defaultDavNamespaces=R,exports.defaultDavProperties=L,exports.formatFileSize=bt,exports.getDavNameSpaces=I,exports.getDavProperties=T,exports.getFavoriteNodes=Dt,exports.getFileActions=Nt,exports.getFileListHeaders=Tt,exports.getNavigation=St,exports.getNewFileMenuEntries=Qe,exports.registerDavProperty=It,exports.registerFileAction=Et,exports.registerFileListHeaders=At,exports.removeNewFileMenuEntry=Je;
74
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}y.prototype.build=function(t){return this.options.preserveOrder?je(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},y.prototype.j2x=function(t,e){let i="",r="";for(let n in t)if(t.hasOwnProperty(n))if(typeof t[n]>"u")this.isAttribute(n)&&(r+="");else if(t[n]===null)this.isAttribute(n)?r+="":n[0]==="?"?r+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+n+"/"+this.tagEndChar;else if(t[n]instanceof Date)r+=this.buildTextValNode(t[n],n,"",e);else if(typeof t[n]!="object"){const s=this.isAttribute(n);if(s)i+=this.buildAttrPairStr(s,""+t[n]);else if(n===this.options.textNodeName){let a=this.options.tagValueProcessor(n,""+t[n]);r+=this.replaceEntitiesValue(a)}else r+=this.buildTextValNode(t[n],n,"",e)}else if(Array.isArray(t[n])){const s=t[n].length;let a="";for(let o=0;o<s;o++){const l=t[n][o];typeof l>"u"||(l===null?n[0]==="?"?r+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+n+"/"+this.tagEndChar:typeof l=="object"?this.options.oneListGroup?a+=this.j2x(l,e+1).val:a+=this.processTextOrObjNode(l,n,e):a+=this.buildTextValNode(l,n,"",e))}this.options.oneListGroup&&(a=this.buildObjectNode(a,n,"",e)),r+=a}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){const s=Object.keys(t[n]),a=s.length;for(let o=0;o<a;o++)i+=this.buildAttrPairStr(s[o],""+t[n][s[o]])}else r+=this.processTextOrObjNode(t[n],n,e);return{attrStr:i,val:r}},y.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Be(t,e,i){const r=this.j2x(t,i+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,r.attrStr,i):this.buildObjectNode(r.val,e,r.attrStr,i)}y.prototype.buildObjectNode=function(t,e,i,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+i+"?"+this.tagEndChar:this.indentate(r)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",n=""),(i||i==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+i+s+">"+t+n:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+i+s+this.tagEndChar+t+this.indentate(r)+n}},y.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e},y.prototype.buildTextValNode=function(t,e,i,r){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(r)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(r)+"<"+e+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),n===""?this.indentate(r)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+i+">"+n+"</"+e+this.tagEndChar}},y.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};function qe(t){return this.options.indentBy.repeat(t)}function Ue(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var ze=y;const Ge=z,Xe=Fe,He=ze;var et={XMLParser:Xe,XMLValidator:Ge,XMLBuilder:He};function Ke(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);if(t=t.trim(),t.length===0||et.XMLValidator.validate(t)!==!0)return!1;let e;const i=new et.XMLParser;try{e=i.parse(t)}catch{return!1}return!(!e||!("svg"in e))}class We{_view;constructor(e){Ye(e),this._view=e}get id(){return this._view.id}get name(){return this._view.name}get caption(){return this._view.caption}get emptyTitle(){return this._view.emptyTitle}get emptyCaption(){return this._view.emptyCaption}get getContents(){return this._view.getContents}get icon(){return this._view.icon}set icon(e){this._view.icon=e}get order(){return this._view.order}set order(e){this._view.order=e}get params(){return this._view.params}set params(e){this._view.params=e}get columns(){return this._view.columns}get emptyView(){return this._view.emptyView}get parent(){return this._view.parent}get sticky(){return this._view.sticky}get expanded(){return this._view.expanded}set expanded(e){this._view.expanded=e}get defaultSortKey(){return this._view.defaultSortKey}}const Ye=function(t){if(!t.id||typeof t.id!="string")throw new Error("View id is required and must be a string");if(!t.name||typeof t.name!="string")throw new Error("View name is required and must be a string");if(t.columns&&t.columns.length>0&&(!t.caption||typeof t.caption!="string"))throw new Error("View caption is required for top-level views and must be a string");if(!t.getContents||typeof t.getContents!="function")throw new Error("View getContents is required and must be a function");if(!t.icon||typeof t.icon!="string"||!Ke(t.icon))throw new Error("View icon is required and must be a valid svg string");if(!("order"in t)||typeof t.order!="number")throw new Error("View order is required and must be a number");if(t.columns&&t.columns.forEach(e=>{if(!(e instanceof dt))throw new Error("View columns must be an array of Column. Invalid column found")}),t.emptyView&&typeof t.emptyView!="function")throw new Error("View emptyView must be a function");if(t.parent&&typeof t.parent!="string")throw new Error("View parent must be a string");if("sticky"in t&&typeof t.sticky!="boolean")throw new Error("View sticky must be a boolean");if("expanded"in t&&typeof t.expanded!="boolean")throw new Error("View expanded must be a boolean");if(t.defaultSortKey&&typeof t.defaultSortKey!="string")throw new Error("View defaultSortKey must be a string");return!0},Ze=function(t){return k().registerEntry(t)},Je=function(t){return k().unregisterEntry(t)},Qe=function(t){return k().getEntries(t)};exports.Column=dt,exports.DefaultType=L,exports.File=st,exports.FileAction=xt,exports.FileType=P,exports.Folder=ot,exports.Header=_t,exports.Navigation=lt,exports.Node=B,exports.NodeStatus=M,exports.Permission=m,exports.View=We,exports.addNewFileMenuEntry=Ze,exports.davGetClient=Ct,exports.davGetDefaultPropfind=Ot,exports.davGetFavoritesReport=it,exports.davGetRecentSearch=Pt,exports.davParsePermissions=nt,exports.davRemoteURL=U,exports.davResultToNode=at,exports.davRootPath=q,exports.defaultDavNamespaces=j,exports.defaultDavProperties=R,exports.formatFileSize=bt,exports.getDavNameSpaces=O,exports.getDavProperties=I,exports.getFavoriteNodes=Dt,exports.getFileActions=Nt,exports.getFileListHeaders=Tt,exports.getNavigation=St,exports.getNewFileMenuEntries=Qe,exports.registerDavProperty=It,exports.registerFileAction=Et,exports.registerFileListHeaders=At,exports.removeNewFileMenuEntry=Je;