package com.ifpdos.udi.sdk.service.doc.mkdocs;

import java.util.Locale;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;

/* JADX INFO: compiled from: DocRenderer.kt */
/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\u001a\u0012\u0010\u0003\u001a\u00020\u00012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0001H\u0002\u001a\u0010\u0010\u0005\u001a\u00020\u00012\u0006\u0010\u0004\u001a\u00020\u0001H\u0002\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0006"}, d2 = {"APIS_DOCUMENT_TEMPLATE", "", "DOC_TEMPLATE", "getGenericSimpleNameWithoutPackage", "className", "getLink", "doc-mkdocs"}, k = 2, mv = {1, 6, 0}, xi = 48)
public final class DocRendererKt {
    private static final String APIS_DOCUMENT_TEMPLATE = "---\ntarget: \"{{target}}\"\ntitle: \"{{commentTitle}}\"\nhide:\n  - toc\n---\n{{commentDescription}}\n";
    private static final String DOC_TEMPLATE = "---\n{{#apis}}\n{{#summaries}}\n\ntarget: \"{{&uri}}\"\nendpoint: true\ntitle: \"{{&summary}}\"\naudit:\n    - linjiawei3046\n    - guorongfei\n    - hedelong\n    - linxuan\nhide:\n    - toc\n\n{{#hasPermission}}\n    permission:\n    {{#isGetSupport}}{{&tap}}get: {{&getPermission}} {{/isGetSupport}}\n    {{#isPostSupport}}{{&tap}}set: {{&postPermission}} {{/isPostSupport}}\n    {{#isNotifySupport}}{{&tap}}notify: {{&notifyPermission}} {{/isNotifySupport}}\n{{/hasPermission}}\n\n{{#hasAlso}}\n    also:\n    {{#also}}\n        {{&tap}}- \"{{&see}}\"\n    {{/also}}\n{{/hasAlso}}\n\n{{#hasDeprecated}}\n    deprecated: \"{{&deprecated}}\"\n{{/hasDeprecated}}\n\n{{#api.alias}}\n    alias: \"{{&api.alias}}\"\n{{/api.alias}}\n\n{{#apply}}\n    apply:\n    {{&tap}}UDI:\n{{/apply}}\n\n{{#hasOpensdks}}\nopensdk:\n    {{#opensdks}}\n    {{&tap}}{{&method}}: \"{{&api}}\"\n    {{/opensdks}}\n{{/hasOpensdks}}\n\n{{#hasFunctionBlocks}}\nfunblk:\n    {{#functionBlocks}}\n    {{&tap}}- \"{{.}}\"\n    {{/functionBlocks}}\n{{/hasFunctionBlocks}}\n\nclassification: \"{{&classification}}\"\n\n{{#hasDepends}}\ndepends: '{{&dependsString}}'\n{{/hasDepends}}\n\n{{/summaries}}\n{{/apis}}\n---\n\n{{#apis}}\n\n# {{&api.comment.summary}}\n\n{{&description}}\n\n{{#isGetSupport}}\n<!--GET BEGIN-->\n{{lineBreak}}\n## 获取\n\n    ### 接口\n    \n    ```http\n    GET {{&getUrl}}\n    ```\n\n    {{#hasGetRequest}}\n        ### URI 参数\n        | Name     | Required | In      | Type                                  | Description                                                                                                                |\n        | -------- | -------- | ------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |\n        {{#getRequestWrapper}}\n            |{{&filed.name}}| {{&isRequired}} |{{pos}}|{{jsonType}}|{{&filed.description}}|\n        {{/getRequestWrapper}}\n    {{/hasGetRequest}}\n\n    ### 响应\n    \n        | Status                    | Type                              | Description                  |\n        | ------------------------- | --------------------------------- | ---------------------------- |\n        |`200 OK`|{{getResponseClassName}}||\n        |`401 Unauthorized`||`token` 非法，或者无访问权限|\n    \n    ### 示例\n    \n    {{&api.get.demoCode}}\n<!-- GET END -->  \n{{/isGetSupport}}\n\n{{#isPostSupport}}\n<!--SET BEGIN-->\n{{lineBreak}}\n## 设置\n\n    ### 接口\n\n    ```http\n    POST {{&postUrl}}\n    ```\n\n    {{#hasPostRequest}}\n        {{#isUriParam}}\n            ### URI 参数 \n            | Name   | Required | In     | Type                                  | Description |\n            | ------ | -------- | ------ | ------------------------------------- | ----------- |\n            {{#postRequestWrapper}}\n                | {{&filed.name}} | {{isRequired}} | {{&pos}} | {{&jsonType}} |{{&filed.description}} |\n            {{/postRequestWrapper}}\n        {{/isUriParam}}\n\n        {{^isUriParam}}\n          ### 请求内容 \n          | Name       | Required | Type   | Description    |\n          | ---------- | -------- | ------ | -------------- |\n          {{#postRequestWrapper}}\n              | {{&filed.name}} | {{isRequired}} | {{&jsonType}} | {{&filed.description}} | \n          {{/postRequestWrapper}}\n        {{/isUriParam}}\n    {{/hasPostRequest}}\n    \n    {{^hasPostResponse}}\n    ### 响应\n    \n    | Status                    | Type | Description                   |\n    | ------------------------- | ---- | ----------------------------- |\n    | `200 OK`                |  {{postResponseDataClass}}  |                             |\n    | `401 Unauthorized`        |      |  `token` 非法，或者无访问权限|\n    {{/hasPostResponse}}\n   \n    ### 示例\n    \n    {{&api.post.demoCode}}\n<!--SET END-->\n{{/isPostSupport}}\n\n{{#isNotifySupport}}\n<!--NOTIFY BEGIN-->\n{{lineBreak}}\n## 监听\n    ### 接口\n\n    ```HTTP\n    POST /v1/event/add/single\n\n    {\n        {{tap}}\"uuid\": \"{uuid}\",\n        {{tap}}\"event\": \"{{&api.uri.path}}\"\n    }\n    ```\n    {{#hasNotify}}\n        ### 请求内容\n        | Name   | Required | Type                                | Description                                                  |\n        | ------ | -------- | ----------------------------------- | ------------------------------------------------------------ |\n        |`uuid`|`true`|`string`||\n        |`event`|`true`|`string`||\n    {{/hasNotify}}\n\n    ### 通知内容\n    | Status             | Type | Description                  |\n    | ------------------ | ---- | ---------------------------- |\n    | `200 OK`           |  {{notifyDataClass}} | 监听成功       |\n    | `401 Unauthorized` |      | `token` 非法，或者无访问权限 |\n\n    ### 示例\n    {{&api.notify.demoCode}}\n<!--NOTIFY END-->\n{{/isNotifySupport}}\n\n<!--DEPEND BEGIN-->\n\n{{#hasDepends}}\n<!-- ONLINE BEGIN -->\n## 系统依赖\n\n|方法|库|接口|功能|\n|-|-|-|-|\n{{#depends}}\n| {{&method}} | {{&lib}} | {{&api}} | {{&platform}} {{&description}} |\n{{/depends}}\n<!-- ONLINE END -->\n{{/hasDepends}}\n\n<!--DEPEND END-->\n\n\n{{/apis}}\n\n{{#classes}}\n<!--STRUCT BEGIN, USED BY:{{usedBy}}-->\n    ## {{&simpleType}}\n    {{#comment}}\n        {{&comment}}\n    {{/comment}}\n    {{lineBreak}}\n    |Name|Type|Description|  \n    |---|---|---|\n    {{#fields}}\n        | {{&name}} |{{&link}}|  {{&description}} |  \n    {{/fields}}\n<!--STRUCT END-->\n{{/classes}}\n\n{{#enums}}\n<!--STRUCT BEGIN, USED BY:{{usedBy}}-->\n    ## {{&simpleType}}\n    {{#comment}}\n        {{&comment}}\n    {{/comment}}\n    {{lineBreak}}\n    |Name|Description|  \n    |---|---|  \n    {{#fields}}\n        | {{&name}} | {{&description}} |  \n    {{/fields}}\n<!--STRUCT END-->\n{{/enums}}\n";

    /* JADX INFO: Access modifiers changed from: private */
    public static final String getLink(String str) {
        StringBuilder sbAppend = new StringBuilder("[").append(str).append("](#");
        String lowerCase = str.toLowerCase(Locale.ROOT);
        Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)");
        return sbAppend.append(lowerCase).append(')').toString();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final String getGenericSimpleNameWithoutPackage(String str) {
        if (str == null) {
            return "";
        }
        String str2 = str;
        if (!StringsKt.contains$default((CharSequence) str2, (CharSequence) "<", false, 2, (Object) null)) {
            return (String) CollectionsKt.last(StringsKt.split$default((CharSequence) str2, new String[]{"."}, false, 0, 6, (Object) null));
        }
        String strSubstring = str.substring(StringsKt.indexOf$default((CharSequence) str2, "<", 0, false, 6, (Object) null) + 1, StringsKt.indexOf$default((CharSequence) str2, ">", 0, false, 6, (Object) null) + 1);
        Intrinsics.checkNotNullExpressionValue(strSubstring, "this as java.lang.String…ing(startIndex, endIndex)");
        String strSubstring2 = str.substring(0, StringsKt.indexOf$default((CharSequence) str2, "<", 0, false, 6, (Object) null) + 1);
        Intrinsics.checkNotNullExpressionValue(strSubstring2, "this as java.lang.String…ing(startIndex, endIndex)");
        String str3 = ((String) CollectionsKt.last(StringsKt.split$default((CharSequence) strSubstring2, new String[]{"."}, false, 0, 6, (Object) null))) + ((String) CollectionsKt.last(StringsKt.split$default((CharSequence) strSubstring, new String[]{"."}, false, 0, 6, (Object) null)));
        Intrinsics.checkNotNullExpressionValue(str3, "simpleName.toString()");
        return str3;
    }
}
