!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bd0895e2-88d9-3ed4-8367-7c3ef36674ac")}catch(e){}}(); define(["exports","./c_flux_action_type"],(function(e,t){"use strict";var n,r,o;function a(t){const n=e.Code[t];return"string"!=typeof n?t.toString():n[0].toLowerCase()+n.substring(1).replace(/[A-Z]/g,(e=>"_"+e.toLowerCase()))}e.MethodKind=void 0,(n=e.MethodKind||(e.MethodKind={}))[n.Unary=0]="Unary",n[n.ServerStreaming=1]="ServerStreaming",n[n.ClientStreaming=2]="ClientStreaming",n[n.BiDiStreaming=3]="BiDiStreaming",function(e){e[e.NoSideEffects=1]="NoSideEffects",e[e.Idempotent=2]="Idempotent"}(r||(r={})),e.Code=void 0,(o=e.Code||(e.Code={}))[o.Canceled=1]="Canceled",o[o.Unknown=2]="Unknown",o[o.InvalidArgument=3]="InvalidArgument",o[o.DeadlineExceeded=4]="DeadlineExceeded",o[o.NotFound=5]="NotFound",o[o.AlreadyExists=6]="AlreadyExists",o[o.PermissionDenied=7]="PermissionDenied",o[o.ResourceExhausted=8]="ResourceExhausted",o[o.FailedPrecondition=9]="FailedPrecondition",o[o.Aborted=10]="Aborted",o[o.OutOfRange=11]="OutOfRange",o[o.Unimplemented=12]="Unimplemented",o[o.Internal=13]="Internal",o[o.Unavailable=14]="Unavailable",o[o.DataLoss=15]="DataLoss",o[o.Unauthenticated=16]="Unauthenticated";class i extends Error{constructor(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.Code.Unknown,r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;var i;super(function(e,t){return e.length?`[${a(t)}] ${e}`:`[${a(t)}]`}(t,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=t,this.code=n;const s=null!==(i=null!=o?o:Array.isArray(r)?void 0:r)&&void 0!==i?i:{};this.metadata=new Headers(s),this.details=[]}}function s(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.Code.Unknown,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t instanceof i?t:t instanceof Error?"AbortError"==t.name?new i(t.message,e.Code.Canceled,r):new i(t.message,e.Code.Unknown,r):new i(String(t),n,r)}function c(t,n){return function(e,t){const n={};for(const[r,o]of Object.entries(e.methods)){const a=t(Object.assign(Object.assign({},o),{localName:r,service:e}));null!=a&&(n[r]=a)}return n}(t,(r=>{switch(r.kind){case e.MethodKind.Unary:return function(e,t,n){return async function(r,o){var a,i;const s=await e.unary(t,n,null==o?void 0:o.signal,null==o?void 0:o.timeoutMs,null==o?void 0:o.headers,r);return null===(a=null==o?void 0:o.onHeader)||void 0===a||a.call(o,s.header),null===(i=null==o?void 0:o.onTrailer)||void 0===i||i.call(o,s.trailer),s.message}}(n,t,r);case e.MethodKind.ServerStreaming:return function(e,t,n){return function(r,o){let a;return{[Symbol.asyncIterator]:()=>({async next(){var i,s;a||(a=await e.serverStream(t,n,null==o?void 0:o.signal,null==o?void 0:o.timeoutMs,null==o?void 0:o.headers,r),null===(i=null==o?void 0:o.onHeader)||void 0===i||i.call(o,a.header));const c=await a.read();return c.done?(null===(s=null==o?void 0:o.onTrailer)||void 0===s||s.call(o,a.trailer),{done:!0,value:void 0}):{done:!1,value:c.value}}})}}}(n,t,r);default:return null}}))}function d(e,t){return t.concat().reverse().reduce(((e,t)=>t(e)),e)}function u(t){let n,r=new Uint8Array(0);function o(e){const t=new Uint8Array(r.length+e.length);t.set(r),t.set(e,r.length),r=t}return new ReadableStream({start(){n=t.getReader()},async pull(t){let a;for(;;){if(void 0===a&&r.byteLength>=5){let e=0;for(let t=1;t<5;t++)e=(e<<8)+r[t];a={flags:r[0],length:e}}if(void 0!==a&&r.byteLength>=a.length+5)break;const e=await n.read();if(e.done)break;o(e.value)}if(void 0===a)return 0==r.byteLength?void t.close():void t.error(new i("premature end of stream",e.Code.DataLoss));const s=r.subarray(5,5+a.length);r=r.subarray(5+a.length),t.enqueue({flags:a.flags,data:s})}})}function l(e,t,n){const r=e.data.length+5,o=new Uint8Array(t,n,r);o[0]=e.flags;for(let t=e.data.length,n=4;n>0;n--)o[n]=t%256,t>>>=8;return o.set(e.data,5),r}class h extends t.Message{constructor(e){super(),this.code=0,this.message="",this.details=[],t.proto3.util.initPartial(e,this)}static fromBinary(e,t){return(new h).fromBinary(e,t)}static fromJson(e,t){return(new h).fromJson(e,t)}static fromJsonString(e,t){return(new h).fromJsonString(e,t)}static equals(e,n){return t.proto3.util.equals(h,e,n)}}function g(t){!function(){try{new Headers}catch(e){throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}}();const n=t;return{async unary(r,o,a,i,c,l){var h,g,f,E;try{return await(g={stream:!1,service:r,method:o,url:`${t.baseUrl.replace(/\/$/,"")}/${r.typeName}/${o.name}`,init:{method:"POST",credentials:null!==(h=t.credentials)&&void 0!==h?h:"same-origin",redirect:"error",mode:"cors"},header:w(c,i),message:l instanceof o.I?l:new o.I(l),signal:null!=a?a:(new AbortController).signal},f=async r=>{var a,i,c;const d=await fetch(r.url,Object.assign(Object.assign({},r.init),{headers:r.header,signal:r.signal,body:m(r.message,t.binaryOptions)})),l=null!==(c=null!==(i=null!==(a=v(d))&&void 0!==a?a:y(d.headers))&&void 0!==i?i:C(d.headers))&&void 0!==c?c:b(d.headers);if(l)throw l;try{if(!d.body)throw"missing response body";const e=u(d.body).getReader(),t=await e.read();if(t.done)throw"premature eof";if(t.value.flags===p)throw _(t.value.data),"unexpected trailer";const r=o.O.fromBinary(t.value.data,n.binaryOptions),a=await e.read();if(a.done)throw"missing trailer";if(a.value.flags!==p)throw"missing trailer";const i=_(a.value.data);if(!(await e.read()).done)throw"extraneous data";return{stream:!1,header:d.headers,message:r,trailer:i}}catch(t){throw s(t,e.Code.Internal,A(d.headers))}},E=n.interceptors,E&&(f=d(f,E)),f(g))}catch(t){throw s(t,e.Code.Internal)}},async serverStream(n,r,o,a,c,l){var h,g,f,E;try{return await(g={stream:!1,service:n,method:r,url:`${t.baseUrl.replace(/\/$/,"")}/${n.typeName}/${r.name}`,init:{method:"POST",credentials:null!==(h=t.credentials)&&void 0!==h?h:"same-origin",redirect:"error",mode:"cors"},header:w(c,a),message:l instanceof r.I?l:new r.I(l),signal:null!=o?o:(new AbortController).signal},f=async o=>{var a,c,d;const l=await fetch(o.url,Object.assign(Object.assign({},o.init),{headers:o.header,signal:o.signal,body:m(o.message,t.binaryOptions)})),h=null!==(d=null!==(c=null!==(a=v(l))&&void 0!==a?a:y(l.headers))&&void 0!==c?c:C(l.headers))&&void 0!==d?d:b(l.headers);if(h)throw h;if(!l.body)throw s("missing response body",e.Code.Internal,A(l.headers));const g=u(l.body).getReader();let f=!1,w=!1;return{stream:!0,service:n,method:r,header:l.headers,trailer:new Headers,async read(){try{const n=await g.read();if(n.done){if(w&&!f)throw new i("missing trailers",e.Code.Internal,A(l.headers));return{done:!0,value:void 0}}return(n.value.flags&p)===p?(f=!0,_(n.value.data).forEach(((e,t)=>this.trailer.append(t,e))),{done:!0,value:void 0}):(w=!0,{done:!1,value:r.O.fromBinary(n.value.data,t.binaryOptions)})}catch(t){throw s(t,e.Code.Unknown,A(l.headers))}}}},E=t.interceptors,E&&(f=d(f,E)),f(g))}catch(t){throw s(t,e.Code.Internal)}}}}function m(e,t){return function(){for(var e=arguments.length,t=new Array(e),n=0;ne+t.data.length+5),0));let o=0;for(const e of t)o+=l(e,r,o);return new Uint8Array(r)}({data:e.toBinary(t),flags:f})}h.runtime=t.proto3,h.typeName="grpc.status.v1.Status",h.fields=t.proto3.util.newFieldList((()=>[{no:1,name:"code",kind:"scalar",T:5},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"details",kind:"message",T:t.Any,repeated:!0}]));const f=0,p=128;function w(e,t){const n=new Headers(null!=e?e:{});return n.set("Content-Type","application/grpc-web+proto"),n.set("X-Grpc-Web","1"),n.set("X-User-Agent","@bufbuild/connect-web"),void 0!==t&&n.set("Grpc-Timeout",`${t}m`),n}function y(t){const n=t.get("Content-Type");switch(null==n?void 0:n.toLowerCase()){case"application/grpc-web":case"application/grpc-web+proto":return;case"application/grpc-web-text":case"application/grpc-web-text+proto":return new i("grpc-web-text is not supported",e.Code.Internal,A(t));default:return new i(`unexpected content type: ${String(n)}`,e.Code.Internal,A(t))}}function v(t){var n;if(function(t){switch(t){case 200:return null;case 400:return e.Code.Internal;case 401:return e.Code.Unauthenticated;case 403:return e.Code.PermissionDenied;case 404:return e.Code.Unimplemented;case 429:case 502:case 503:case 504:return e.Code.Unavailable;default:return e.Code.Unknown}}(t.status))return new i(decodeURIComponent(null!==(n=t.headers.get("grpc-message"))&&void 0!==n?n:""),A(t.headers))}function b(t){var n;const r=t.get("grpc-status");if(null===r)return;const o=parseInt(r);return 0!==o?o in e.Code?new i(decodeURIComponent(null!==(n=t.get("grpc-message"))&&void 0!==n?n:""),o,void 0,A(t)):new i(`invalid grpc-status: ${r}`,e.Code.Internal,void 0,A(t)):void 0}function C(n){const r=n.get("grpc-status-details-bin");if(null!=r)try{const o=function(n,r,o){try{const e=t.protoBase64.dec(n);return r?r.fromBinary(e,o):e}catch(t){throw new i(t instanceof Error?t.message:String(t),e.Code.DataLoss)}}(r,h);if(0==o.code)return;const a=new i(o.message,o.code,void 0,n);return a.details.push(...o.details),a}catch(t){const r=s(t,e.Code.Internal);return n.forEach(((e,t)=>r.metadata.append(t,e))),r}}function _(e){var t;const n=function(e){const t=new Headers,n=String.fromCharCode(...e).split("\r\n");for(const e of n){if(""===e)continue;const n=e.indexOf(":");if(n>0){const r=e.substring(0,n).trim(),o=e.substring(n+1).trim();t.append(r,o)}}return t}(e),r=null!==(t=C(n))&&void 0!==t?t:b(n);if(r)throw r;return n}function A(e){return Object.fromEntries(Array.from(e.entries()))}function E(e,t,n={}){if(e)return;const r=new Error(`Assertion Error: ${t}`),{tags:o=[],exc_extra:a=null}=n;throw r.assertOptions={tags:o.concat("module:exception","assert"),exc_extra:a},r.isAssertion=!0,r}const S=/^(?:([^:\/\\?#]+):)?(?:[\/\\]{2}([^\/\\?#]*))?([^?#]*)(?:\?([^#]*))?(?:[#](.*))?$/,x=/^[a-zA-Z][a-zA-Z0-9+.\-]*$/;class O{constructor(e={}){this.dict={},this.add(e)}static parseString(e){if(!e)return{};const t={};return e.split("&").forEach((e=>{if(""!==e){const n=e.split("="),r=O.decode(n[0]),o=O.decode(n.slice(1).join("="));if(t.hasOwnProperty(r)){const e=t[r];let n;n="string"==typeof e?[e]:void 0===e?[]:e,n.push(o),t[r]=n}else t[r]=o}})),t}add(e,t){if("string"==typeof e)t&&(Array.isArray(t)?this.dict[e]=t.map(String):this.dict[e]=String(t));else for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];null!=n&&(Array.isArray(n)?this.dict[t]=n.map(String):this.dict[t]=String(n))}return this}remove(e){return delete this.dict[e],this}replace(e){return this.dict=e,this}toString(e){const t=[],n=Object.keys(this.dict).sort(e);for(const e of n)if(this.dict.hasOwnProperty(e)){const n=this.dict[e];Array.isArray(n)?n.forEach((n=>{t.push(O.encode(e)+"="+O.encode(n))})):t.push(O.encode(e)+"="+O.encode(n))}return t.length?t.join("&"):""}static decode(e){return null==e?"":k.decode(e.replace(/\+/g,"%20"))}static encode(e){return null==e?"":k.encode(e).replace(/%20/g,"+")}}class k{constructor(e={}){this.query=new O,this.initFromObject(e)}initFromObject(e){this.setScheme(e.scheme),this.authority=e.authority||"",this.path=e.path||"",this.setQuery(e.query),this.fragment=e.fragment||""}getScheme(){return this.scheme}getAuthority(){return this.authority}getPath(){return this.path}getQuery(){return this.query.dict}getFragment(){return this.fragment}setScheme(e=""){return E(!e||Boolean(e.match(x)),"Invalid scheme",{exc_extra:{scheme_param:e}}),this.scheme=e,this}setAuthority(e=""){return this.authority=e,this}setPath(e=""){return this.path=e,this}setQuery(e={}){return this.query=new O(e),this}setFragment(e=""){return this.fragment=e,this}updateQuery(e,t){return this.query.add(e,t),this}removeQuery(e){return this.query.remove(e),this}clone(){return new k(this.toObject())}toObject(){return{scheme:this.getScheme(),authority:this.getAuthority(),path:this.getPath(),query:this.getQuery(),fragment:this.getFragment()}}toString(e){let t="";return this.scheme&&(t+=this.scheme+":"),this.authority&&(t+="//"+k.encode(this.authority,":@[]")),t+this.toRelativeUri(e)}toRelativeUri(e){let t="";this.path&&(E(!this.authority||!this.path.length||"/"===this.path[0],'Path must start with a "/" if URI is not relative'),t+=k.encode(this.path,"/"));const n=this.query.toString(e);return n&&(t+="?"+n),this.fragment&&(t+="#"+k.encode(this.fragment,":@[]/&=+?#!")),t}static parse(e){const t=String(e).match(S)||[],[,n,r,o,a,i]=t,s=new k;return s.setScheme(n),s.setAuthority(k.decode(r)),s.setPath(k.decode(o)),s.setQuery(O.parseString(a)),s.setFragment(k.decode(i)),s}static decode(e){return e?decodeURIComponent(e):""}static encode(e,t=""){if(!e)return"";e=encodeURIComponent(e),t+="~";for(const n of t){const t=encodeURIComponent(n);e=e.replace(new RegExp(t,"g"),n)}return e}static encode_parts(e,t="/"){return e.split(t).map((e=>k.encode(e))).join(t)}}k.Query=O;const U=function(e,t){if(!e)throw new Error(t)},T=/^([0-9]{1,3}\.){3}[0-9]{1,3}$/,I=function(e){if(e.match(T))return[e];const t=e.split("."),n=[];for(let e=0;e0,`${t} must not be empty`),U(!function(e){if(null==e)return!1;for(const t of P)if(-1!==e.indexOf(t))return!0;return!1}(e),`${t} contains illegal characters`)},R=e=>$(e,"Cookie name",!1),D=e=>{return t=e,n="Cookie max age",void U(!isNaN(Number(t)),`${n} must be numeric, but was ${t}`);var t,n},j=function(e,t,n={}){var r,o;R(e),(e=>{$(e,"Cookie value",!0)})(t),n.maxAge&&D(n.maxAge),n.domain&&(r=n.domain,$(r,"Cookie domain",!1)),n.path&&(o=n.path,$(o,"Cookie path",!1));const a=[`${e}=${t}`];n.maxAge&&a.push(`max-age=${n.maxAge}`),n.domain&&a.push(`domain=${n.domain}`),n.path&&a.push(`path=${n.path}`),n.samesite&&a.push(`samesite=${n.samesite}`),a.push("secure"),document.cookie=a.join("; ")},L={create(e,t,n,r,o="/",a="lax"){let i;null!=n&&(U("number"==typeof n,"Cookie max age days must be a number"),i=24*n*60*60),j(e,t,{maxAge:i,path:o,domain:r,samesite:a})},read(e){R(e);const t=[];for(const n of document.cookie.split(";")){const r=n.split("=",1)[0];r.trim()===e&&t.push(n.substring(r.length+1,n.length).trim())}let n=!1;const r=[];for(const e of t)""===e?n=!0:r.push(e);return 1===r.length?r[0]:r.length>1?(L.delete(e),null):n?"":null},delete(e){const t=[null,...I(window.location.hostname)],n=[null,...N(window.location.pathname)];for(const r of t)for(const t of n)j(e,"",{maxAge:-1,domain:r,path:t,samesite:"lax"})},are_enabled:()=>navigator.cookieEnabled?navigator.cookieEnabled:(document.cookie="this_is_a_test_cookie",-1!==document.cookie.indexOf("this_is_a_test_cookie"))};function q(){return L.read("__Host-js_csrf")}function B(){const e=q();if(!e){let e="Failed to read csrf cookie.";window!==top?e+=" This could be a result of restrictions of cookies inside iframes in certain browsers, or it could just be that the user has disabled or deleted their cookies.":e+=" This likely means either the user deleted their cookies after loading the page, that the user has disallowed cookies, or has some extension interfering with cookies.";const t=new Error(e);throw t.severity="critical",t.trackAsMetric="failed_csrf_cookie_read"+(window!==top?"/iframed":""),t}return e}const F=e=>!!e&&"0"!==e.toString();function X(e){const n={};return e&&(e.activeUser&&F(e.activeUser.id)&&(n["X-Dropbox-Uid"]=e.activeUser.id.toString()),e.activeTeam&&F(e.activeTeam.id)&&(n["X-Dropbox-Teamid"]=e.activeTeam.id.toString()),(e.authRole||e.authActionType)&&(n["X-Dropbox-Team-Authorization"]=JSON.stringify({auth_role:String(e.authRole),auth_action_type:String(e.authActionType)}))),t.getPageAuthChannel()!==t.AuthChannel.OAUTH_TOKEN&&(n["X-CSRF-Token"]=B()),n}function H(e,t){const n={grpc_service:t.service.typeName,grpc_method:t.method.name};"code"in e&&(n.grpc_code=(e.code||"").toString());const r="metadata"in e&&e.metadata?e.metadata.get("x-dropbox-request-id"):void 0;r&&(n.xhr_request_id=r);const o=e;return o.excExtra=n,o.tags=["grpc-web"],o}const W=e=>async t=>{try{const n=await e(t);return n.stream?{...n,read:async()=>{try{return await n.read()}catch(e){throw H(e,t)}}}:n}catch(e){throw H(e,t)}},M=[];function Q(e){return e?"zh-TW"===(e=e.replace(/_/gi,"-"))?"zh-Hant-TW":"zh-CN"===e?"zh-Hans-CN":"es"===e?"es-419":"es-ES"===e?"es":e:e}"undefined"!=typeof __CONNECT_WEB_DEVTOOLS__&&M.push(__CONNECT_WEB_DEVTOOLS__),window.addEventListener("connect-web-dev-tools-ready",(()=>{"undefined"==typeof __CONNECT_WEB_DEVTOOLS__||M.includes(__CONNECT_WEB_DEVTOOLS__)||M.push(__CONNECT_WEB_DEVTOOLS__)}));const z="/web-grpc/edison";function K(e=""){return"undefined"!=typeof window?window.location.host:k.parse(e).getAuthority()}const V=e=>async n=>{const r=t.getRequestOriginalUrl(),o={"Accept-Language":Q(t.getPageLocale()),"X-Edison-Atlasservlet":t.getAtlasservlet(),"X-Edison-Page-Name":t.getPageName(),"X-Edison-Original-Url":r,"X-Edison-Original-Referer":t.getRequestOriginalReferrer()||"","X-Edison-Prompt-Controller":t.getInitData().deprecatedPromptController||"","X-Edison-Prompt-Action":t.getInitData().deprecatedPromptAction||"","X-Dropbox-Browser-Id":t.getDeviceIdHex(),"X-Dropbox-Authority":K(r),...X(t.getAuthRequestInfo()),...t.getExtraHttpRequestHeaders()};return t.getPageName()&&(o["X-Dropbox-Client-Yaps-Attribution"]=`${t.getAtlasservlet()}:${t.getPageName()}`),Object.entries(o).filter((([e,t])=>!!t)).filter((([e,t])=>!(e.toLowerCase().startsWith("x-")&&n.header.has(e)))).forEach((([e,t])=>{t&&!n.header.has(e)&&n.header.set(e,t)})),await e(n)};function J(e=z){return g({baseUrl:e,interceptors:[W,V,...M]})}const G=["on","control","v1","v2","v3","v4","v5","v6"];e.ConnectError=i,e.Cookies=L,e.PAP_Log_ClickShare=function(e){return{class:"sharing_sender",action:"log",object:"click_share",properties:e}},e.URI=k,e.assert=E,e.assertDropboxDomain=function(e){const t=document.createElement("a");t.href=e;const n=t.hostname||window.location.hostname;if(!n.endsWith(".dropbox.com"))throw new Error(`Cannot send the CSRF token to ${n}`)},e.createEdisonGRPCWebPromiseClient=function(e,t=z){return c(e,J(t))},e.createEdisonGrpcWebTransport=J,e.getFlexibleSharingEntryPointVariantFromString=function(e){return G.find((t=>t===(null==e?void 0:e.toLowerCase())))},e.localeToBcp47LangTag=Q,e.mustReadCsrfToken=B,e.readCsrfToken=q})); //# sourceMappingURL=c_pap-events_enums_flexible_sharing_entry_point_variant-utils.js-vflIrpfzb.map //# debugId=bd0895e2-88d9-3ed4-8367-7c3ef36674ac